aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-09-23 23:32:46 +0100
committergingerBill <bill@gingerbill.org>2021-09-23 23:32:46 +0100
commit8c4197af38e6a342554c9b5602206916d983c6bc (patch)
tree161e96358637ea8f9edf8a8a46ce1889bd6340bc /src/check_expr.cpp
parent374f98356ccd078a138598292565872bfcb3061f (diff)
Add `#load_or(path_string, default_byte_slice)`
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index 08be7b7bc..13643b283 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -5865,7 +5865,15 @@ ExprKind check_call_expr(CheckerContext *c, Operand *operand, Ast *call, Ast *pr
proc->kind == Ast_BasicDirective) {
ast_node(bd, BasicDirective, proc);
String name = bd->name.string;
- if (name == "location" || name == "assert" || name == "panic" || name == "defined" || name == "config" || name == "load") {
+ if (
+ name == "location" ||
+ name == "assert" ||
+ name == "panic" ||
+ name == "defined" ||
+ name == "config" ||
+ name == "load" ||
+ name == "load_or"
+ ) {
operand->mode = Addressing_Builtin;
operand->builtin_id = BuiltinProc_DIRECTIVE;
operand->expr = proc;
@@ -6619,10 +6627,11 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type
o->type = t_source_code_location;
o->mode = Addressing_Value;
} else if (
- name == "load" ||
name == "assert" ||
name == "defined" ||
- name == "config"
+ name == "config" ||
+ name == "load" ||
+ name == "load_or"
) {
error(node, "'#%.*s' must be used as a call", LIT(name));
o->type = t_invalid;