1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00
ton/tolk
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
..
abscode.cpp [Tolk] Smart casts and control flow graph 2025-02-28 16:44:15 +03:00
analyzer.cpp [Tolk] throw interrupts control flow; never type 2025-02-28 16:44:18 +03:00
asmops.cpp [Tolk] Support syntax tensorVar.0 and tupleVar.0 2025-01-27 15:30:21 +03:00
ast-from-tokens.cpp [Tolk] Nullable types T? and null safety 2025-02-28 16:41:41 +03:00
ast-from-tokens.h [Tolk] AST-based semantic analysis, get rid of Expr 2025-01-13 20:28:44 +07:00
ast-replacer.h [Tolk] Nullable types T? and null safety 2025-02-28 16:41:41 +03:00
ast-replicator.h [Tolk] Nullable types T? and null safety 2025-02-28 16:41:41 +03:00
ast-stringifier.h [Tolk] Nullable types T? and null safety 2025-02-28 16:41:41 +03:00
ast-visitor.h [Tolk] Nullable types T? and null safety 2025-02-28 16:41:41 +03:00
ast.cpp [Tolk] Smart casts and control flow graph 2025-02-28 16:44:15 +03:00
ast.h [Tolk] Smart casts and control flow graph 2025-02-28 16:44:15 +03:00
builtins.cpp [Tolk] throw interrupts control flow; never type 2025-02-28 16:44:18 +03:00
CMakeLists.txt [Tolk] Smart casts and control flow graph 2025-02-28 16:44:15 +03:00
codegen.cpp [Tolk] throw interrupts control flow; never type 2025-02-28 16:44:18 +03:00
compiler-state.cpp [Tolk] Nullable types T? and null safety 2025-02-28 16:41:41 +03:00
compiler-state.h [Tolk] Nullable types T? and null safety 2025-02-28 16:41:41 +03:00
constant-evaluator.cpp [Tolk] Nullable types T? and null safety 2025-02-28 16:41:41 +03:00
constant-evaluator.h [Tolk] AST-based semantic analysis, get rid of Expr 2025-01-13 20:28:44 +07:00
fwd-declarations.h [Tolk] Nullable types T? and null safety 2025-02-28 16:41:41 +03:00
generics-helpers.cpp [Tolk] Smart casts and control flow graph 2025-02-28 16:44:15 +03:00
generics-helpers.h [Tolk] Smart casts and control flow graph 2025-02-28 16:44:15 +03:00
lexer.cpp [Tolk] Allow cell and slice be valid identifiers 2025-01-27 15:30:21 +03:00
lexer.h [Tolk] Allow cell and slice be valid identifiers 2025-01-27 15:30:21 +03:00
optimize.cpp [Tolk] Embedded stdlib.tolk, CompilerState, strict includes 2024-11-02 01:33:08 +04:00
pipe-ast-to-legacy.cpp [Tolk] Smart casts and control flow graph 2025-02-28 16:44:15 +03:00
pipe-calc-rvalue-lvalue.cpp [Tolk] Nullable types T? and null safety 2025-02-28 16:41:41 +03:00
pipe-check-inferred-types.cpp [Tolk] Smart casts and control flow graph 2025-02-28 16:44:15 +03:00
pipe-check-pure-impure.cpp [Tolk] Nullable types T? and null safety 2025-02-28 16:41:41 +03:00
pipe-check-rvalue-lvalue.cpp [Tolk] Nullable types T? and null safety 2025-02-28 16:41:41 +03:00
pipe-constant-folding.cpp [Tolk] Nullable types T? and null safety 2025-02-28 16:41:41 +03:00
pipe-discover-parse-sources.cpp [Tolk] Rewrite the type system from Hindley-Milner to static typing 2025-01-15 15:38:43 +03:00
pipe-find-unused-symbols.cpp [Tolk] Nullable types T? and null safety 2025-02-28 16:41:41 +03:00
pipe-generate-fif-output.cpp [Tolk] Nullable types T? and null safety 2025-02-28 16:41:41 +03:00
pipe-infer-types-and-calls.cpp [Tolk] throw interrupts control flow; never type 2025-02-28 16:44:18 +03:00
pipe-optimize-boolean-expr.cpp [Tolk] Nullable types T? and null safety 2025-02-28 16:41:41 +03:00
pipe-refine-lvalue-for-mutate.cpp [Tolk] Nullable types T? and null safety 2025-02-28 16:41:41 +03:00
pipe-register-symbols.cpp [Tolk] Nullable types T? and null safety 2025-02-28 16:41:41 +03:00
pipe-resolve-identifiers.cpp [Tolk] Smart casts and control flow graph 2025-02-28 16:44:15 +03:00
pipeline.h [Tolk] Smart casts and control flow graph 2025-02-28 16:44:15 +03:00
platform-utils.h [Tolk] Rewrite the type system from Hindley-Milner to static typing 2025-01-15 15:38:43 +03:00
smart-casts-cfg.cpp [Tolk] Smart casts and control flow graph 2025-02-28 16:44:15 +03:00
smart-casts-cfg.h [Tolk] throw interrupts control flow; never type 2025-02-28 16:44:18 +03:00
src-file.cpp [Tolk] Smart casts and control flow graph 2025-02-28 16:44:15 +03:00
src-file.h [Tolk] Smart casts and control flow graph 2025-02-28 16:44:15 +03:00
stack-transform.cpp [Tolk] Initial commit of TOLK Language: fork all sources from FunC 2024-11-02 01:33:08 +04:00
symtable.cpp [Tolk] Smart casts and control flow graph 2025-02-28 16:44:15 +03:00
symtable.h [Tolk] Nullable types T? and null safety 2025-02-28 16:41:41 +03:00
tolk-main.cpp [Tolk] Completely rework stdlib: multiple files and renaming 2024-11-02 03:44:13 +04:00
tolk-version.h [Tolk] Bump version to v0.8 2025-01-27 15:30:21 +03:00
tolk-wasm.cpp [Tolk] Completely rework stdlib: multiple files and renaming 2024-11-02 03:44:13 +04:00
tolk.cpp [Tolk] Smart casts and control flow graph 2025-02-28 16:44:15 +03:00
tolk.h [Tolk] throw interrupts control flow; never type 2025-02-28 16:44:18 +03:00
type-system.cpp [Tolk] Smart casts and control flow graph 2025-02-28 16:44:15 +03:00
type-system.h [Tolk] Smart casts and control flow graph 2025-02-28 16:44:15 +03:00