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

[FunC] Add builtin keyword to be used in stdlib later on

This commit is contained in:
Aleksandr Kirsanov 2024-05-07 13:10:56 +03:00
parent acf0043342
commit cdef8302b0
No known key found for this signature in database
GPG key ID: B758BBAA01FFB3D3
6 changed files with 99 additions and 36 deletions

View file

@ -0,0 +1,33 @@
(int, int) moddiv(int x, int y) pure builtin;
() throw_if(int excno, int cond) builtin;
() throwIf(int excNo, int cond) { return throw_if(excNo, cond); }
forall X -> int null?(X x) pure builtin;
_ test1() method_id(101) {
try {
var (rem, _) = moddiv(1, 1);
throwIf(101, rem != 100500);
return 0;
} catch(_, excNo) {
return excNo;
}
}
(int, int, int) main() {
int x = 112;
int y = 3;
var wh = x~moddiv(y);
throwIf(103, wh != 37);
var cc = nil;
return (wh, x, null?(cc));
}
{-
TESTCASE | 0 | | 37 1 -1
TESTCASE | 101 | | 101
@fif_codegen_avoid DECLPROC moddiv
@fif_codegen_avoid DECLPROC throwIf
-}

View file

@ -0,0 +1,10 @@
(int, int) moddiv2(int x, int y) builtin;
{-
@compilation_should_fail
@stderr
"""
`builtin` used for non-builtin function
(int, int) moddiv2
"""
-}