1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

[FunC] Deprecate method_id specifier, introduce get keyword

`get` keyword behaves exactly like `method_id` (auto-calc hash),
but it's placed on the left, similar to Tact: `get T name()`.

`method_id(n)` is still valid, considering it can't be invoked by name,
since a client will compute another hash.
It's supposed it will be still used in tests and in low-level code
(not to be called externally, but to be called after replacing c3).

`get(hash)` is invalid, this keyword does not accept anything.
This commit is contained in:
Aleksandr Kirsanov 2024-05-21 15:34:37 +03:00
parent 7afa9292c3
commit 7b8268d99f
No known key found for this signature in database
GPG key ID: B758BBAA01FFB3D3
16 changed files with 103 additions and 72 deletions

View file

@ -168,27 +168,27 @@ _ skipBits(slice s, int len) { return skip_bits(s, len); }
;; Get methods
int seqno() method_id {
get int seqno() {
return get_data().begin_parse().preload_uint(32);
}
int get_subwallet_id() method_id {
get int get_subwallet_id() {
return get_data().begin_parse().skip_bits(32).preload_uint(32);
}
int get_public_key() method_id {
get int get_public_key() {
var cs = get_data().begin_parse().skip_bits(64);
return cs.preload_uint(256);
}
int is_plugin_installed(int wc, int addr_hash) method_id {
get int is_plugin_installed(int wc, int addr_hash) {
var ds = get_data().begin_parse().skipBits(32 + 32 + 256);
var plugins = ds~load_dict();
var (_, success?) = plugins.dict_get?(8 + 256, begin_cell().store_int(wc, 8).store_uint(addr_hash, 256).end_cell().begin_parse());
return success?;
}
tuple get_plugin_list() method_id {
get tuple get_plugin_list() {
var list = null();
var ds = get_data().begin_parse().skip_bits(32 + 32 + 256);
var plugins = ds~load_dict();