✓
Passing This code compiles and runs correctly.
Code
// Test: Conditional import with flag OFF
// When --profile flag is NOT passed, the import should be skipped entirely
// The AST should NOT contain any import_decl for this line
~[profile]import "$std/profiler"
~event test {}
| done {}
Expected AST
{
"module_annotations": [],
"items": [
{
"type": "import_decl",
"path": "$std/compiler",
"location": {
"file": "tests/regression/300_ADVANCED_FEATURES/310_COMPTIME/310_028_conditional_import_flag_off/input.kz",
"line": 2,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/300_ADVANCED_FEATURES/310_COMPTIME/310_028_conditional_import_flag_off/input.kz",
"line": 2,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/300_ADVANCED_FEATURES/310_COMPTIME/310_028_conditional_import_flag_off/input.kz",
"line": 3,
"col": 0
}
},
{
"type": "host_line",
"module": "input",
"location": {
"file": "tests/regression/300_ADVANCED_FEATURES/310_COMPTIME/310_028_conditional_import_flag_off/input.kz",
"line": 4,
"col": 0
}
},
{
"type": "event_decl",
"name": "test",
"path": [
"test"
],
"module": "input",
"input": {
"fields": []
},
"branches": [
{
"name": "done",
"payload": {
"fields": []
}
}
],
"location": {
"file": "tests/regression/300_ADVANCED_FEATURES/310_COMPTIME/310_028_conditional_import_flag_off/input.kz",
"line": 10,
"col": 0
}
}
]
}Test Configuration
PARSER_TEST