1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00
ton/tolk-tester
tolk-vm ef0328837f
[Tolk] throw interrupts control flow; never type
In FunC (and in Tolk before) throwing an exception is just
calling a built-in function:
> throw 123; // actually, __throw(123)
Since it's a regular function, the compiler was not aware
that execution will stop, and all following code is unreachable.
For instance, `throw` in the end on function needed to be
followed by `return` statement.

Now, `throw` interrupts control flow, all statements after
it are considered unreachable. At IR level, code Ops are
also not produced.

This works because a built-in __throw() now has `never` type.
It can also be applied to custom functions:
> fun alwaysThrow(): never { throw 123; }
The code after alwaysThrow() call will also be unreachable.
2025-02-28 16:44:18 +03:00
..
tests [Tolk] throw interrupts control flow; never type 2025-02-28 16:44:18 +03:00
tolk-tester.js [Tolk] AST-based semantic analysis, get rid of Expr 2025-01-13 20:28:44 +07:00
tolk-tester.py [Tolk] AST-based semantic analysis, get rid of Expr 2025-01-13 20:28:44 +07:00