aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/all_types.hpp1
-rw-r--r--src/ir.cpp10
-rw-r--r--src/parser.cpp2
3 files changed, 10 insertions, 3 deletions
diff --git a/src/all_types.hpp b/src/all_types.hpp
index 6fbd987b9e..f57c3124da 100644
--- a/src/all_types.hpp
+++ b/src/all_types.hpp
@@ -648,6 +648,7 @@ struct AstNodeFnCallExpr {
ZigList<AstNode *> params;
bool is_builtin;
bool is_async;
+ bool seen; // used by @compileLog
AstNode *async_allocator;
};
diff --git a/src/ir.cpp b/src/ir.cpp
index 0fcbb60fe8..063be4e952 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -17194,9 +17194,13 @@ static IrInstruction *ir_analyze_instruction_compile_log(IrAnalyze *ira, IrInstr
}
fprintf(stderr, "\n");
- // Here we bypass higher level functions such as ir_add_error because we do not want
- // invalidate_exec to be called.
- add_node_error(ira->codegen, instruction->base.source_node, buf_sprintf("found compile log statement"));
+ auto *expr = &instruction->base.source_node->data.fn_call_expr;
+ if (!expr->seen) {
+ // Here we bypass higher level functions such as ir_add_error because we do not want
+ // invalidate_exec to be called.
+ add_node_error(ira->codegen, instruction->base.source_node, buf_sprintf("found compile log statement"));
+ }
+ expr->seen = true;
return ir_const_void(ira, &instruction->base);
}
diff --git a/src/parser.cpp b/src/parser.cpp
index 3a6ce04647..6fe78c14c3 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -2739,6 +2739,7 @@ static AstNode *ast_parse_async_prefix(ParseContext *pc) {
AstNode *res = ast_create_node(pc, NodeTypeFnCallExpr, async);
res->data.fn_call_expr.is_async = true;
+ res->data.fn_call_expr.seen = false;
if (eat_token_if(pc, TokenIdCmpLessThan) != nullptr) {
AstNode *prefix_expr = ast_expect(pc, ast_parse_prefix_expr);
expect_token(pc, TokenIdCmpGreaterThan);
@@ -2759,6 +2760,7 @@ static AstNode *ast_parse_fn_call_argumnets(ParseContext *pc) {
AstNode *res = ast_create_node(pc, NodeTypeFnCallExpr, paren);
res->data.fn_call_expr.params = params;
+ res->data.fn_call_expr.seen = false;
return res;
}