add '#caller_expression'

This commit is contained in:
Laytan Laats
2024-09-14 21:43:25 +02:00
parent 129d85fe7d
commit 603efa860a
9 changed files with 133 additions and 13 deletions

View File

@@ -7807,7 +7807,8 @@ gb_internal ExprKind check_call_expr(CheckerContext *c, Operand *operand, Ast *c
name == "load" ||
name == "load_directory" ||
name == "load_hash" ||
name == "hash"
name == "hash" ||
name == "caller_expression"
) {
operand->mode = Addressing_Builtin;
operand->builtin_id = BuiltinProc_DIRECTIVE;
@@ -8725,6 +8726,10 @@ gb_internal ExprKind check_basic_directive_expr(CheckerContext *c, Operand *o, A
error(node, "#caller_location may only be used as a default argument parameter");
o->type = t_source_code_location;
o->mode = Addressing_Value;
} else if (name == "caller_expression") {
error(node, "#caller_expression may only be used as a default argument parameter");
o->type = t_string;
o->mode = Addressing_Value;
} else {
if (name == "location") {
init_core_source_code_location(c->checker);