mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
[Tolk] Compiler built-in __expect_type()
for testing purposes
Currently, tolk-tester can test various "output" of the compiler: pass input and check output, validate fif codegen, etc. But it can not test compiler internals and AST representation. I've added an ability to have special functions to check/expose internal compiler state. The first (and the only now) is: > __expect_type(some_expr, "<type>"); Such a call has special treatment in a compilation process. Compilation fails if this expression doesn't have requested type. It's intended to be used in tests only. Not present in stdlib.
This commit is contained in:
parent
c720204199
commit
989629a832
9 changed files with 147 additions and 7 deletions
|
@ -1255,6 +1255,13 @@ void define_builtins() {
|
|||
define_builtin_func("debugDumpStack", {}, Unit, nullptr,
|
||||
AsmOp::Custom("DUMPSTK", 0, 0),
|
||||
0);
|
||||
|
||||
// functions not presented in stdlib at all
|
||||
// used in tolk-tester to check/expose internal compiler state
|
||||
// each of them is handled in a special way, search by its name
|
||||
define_builtin_func("__expect_type", {TypeDataUnknown::create(), Slice}, Unit, nullptr,
|
||||
AsmOp::Nop(),
|
||||
FunctionData::flagMarkedAsPure);
|
||||
}
|
||||
|
||||
} // namespace tolk
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue