aboutsummaryrefslogtreecommitdiff
path: root/src/check_builtin.cpp
diff options
context:
space:
mode:
authorKarl Zylinski <karl@zylinski.se>2024-09-17 19:36:17 +0200
committerKarl Zylinski <karl@zylinski.se>2024-09-17 19:36:17 +0200
commit093ade050445b3e348177e30fb1fc9d726f7b289 (patch)
tree5122cfefa5fefbab9d27d5d8adacd8739eeeb5de /src/check_builtin.cpp
parent3d7b92426081cd9f3197b13f7384a52dbac5379a (diff)
parent6ef779cd5c8260b2e6979e676d28489fd53dd599 (diff)
Merge branch 'master' into file-tags-without-comments
Diffstat (limited to 'src/check_builtin.cpp')
-rw-r--r--src/check_builtin.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp
index 888aa074d..909eb668e 100644
--- a/src/check_builtin.cpp
+++ b/src/check_builtin.cpp
@@ -1632,6 +1632,22 @@ gb_internal bool check_builtin_procedure_directive(CheckerContext *c, Operand *o
operand->type = t_source_code_location;
operand->mode = Addressing_Value;
+ } else if (name == "caller_expression") {
+ if (ce->args.count > 1) {
+ error(ce->args[0], "'#caller_expression' expects either 0 or 1 arguments, got %td", ce->args.count);
+ }
+ if (ce->args.count > 0) {
+ Ast *arg = ce->args[0];
+ Operand o = {};
+ Entity *e = check_ident(c, &o, arg, nullptr, nullptr, true);
+ if (e == nullptr || (e->flags & EntityFlag_Param) == 0) {
+ error(ce->args[0], "'#caller_expression' expected a valid earlier parameter name");
+ }
+ arg->Ident.entity = e;
+ }
+
+ operand->type = t_string;
+ operand->mode = Addressing_Value;
} else if (name == "exists") {
if (ce->args.count != 1) {
error(ce->close, "'#exists' expects 1 argument, got %td", ce->args.count);