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:
parent
7afa9292c3
commit
7b8268d99f
16 changed files with 103 additions and 72 deletions
|
@ -40,7 +40,7 @@ int test1() method_id(101) {
|
|||
return s~load_uint(32);
|
||||
}
|
||||
|
||||
int test2(int ret) method_id {
|
||||
get int test2(int ret) {
|
||||
return setAndGetDataWrapper(ret);
|
||||
}
|
||||
|
||||
|
|
8
crypto/func/auto-tests/tests/invalid-get-method-1.fc
Normal file
8
crypto/func/auto-tests/tests/invalid-get-method-1.fc
Normal file
|
@ -0,0 +1,8 @@
|
|||
get (int, int) hello(int x, int y) method_id(123) {
|
||||
return (x, y);
|
||||
}
|
||||
|
||||
{-
|
||||
@compilation_should_fail
|
||||
@stderr both `get` and `method_id` are not allowed
|
||||
-}
|
|
@ -1,28 +1,28 @@
|
|||
slice ascii_slice() method_id {
|
||||
get slice ascii_slice() {
|
||||
return "string";
|
||||
}
|
||||
|
||||
slice raw_slice() method_id {
|
||||
get slice raw_slice() {
|
||||
return "abcdef"s;
|
||||
}
|
||||
|
||||
slice addr_slice() method_id {
|
||||
get slice addr_slice() {
|
||||
return "Ef8zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM0vF"a;
|
||||
}
|
||||
|
||||
int string_hex() method_id {
|
||||
get int string_hex() {
|
||||
return "ABCDEFGHIJKLMNOPQRSTUVWXYZ012345"u;
|
||||
}
|
||||
|
||||
int string_minihash() method_id {
|
||||
get int string_minihash() {
|
||||
return "transfer(slice, int)"h;
|
||||
}
|
||||
|
||||
int string_maxihash() method_id {
|
||||
get int string_maxihash() {
|
||||
return "transfer(slice, int)"H;
|
||||
}
|
||||
|
||||
int string_crc32() method_id {
|
||||
get int string_crc32() {
|
||||
return "transfer(slice, int)"c;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue