aboutsummaryrefslogtreecommitdiff
path: root/src/checker.c
diff options
context:
space:
mode:
authorZachary Pierson <zacpiersonhehe@gmail.com>2017-02-07 23:21:52 -0600
committerZachary Pierson <zacpiersonhehe@gmail.com>2017-02-07 23:21:52 -0600
commit73c5c5d5d3315ac956b9846adfda9da8d204e4c8 (patch)
treea1ed27ad5360c59ef1fdec1e78af03fe6f0fcf98 /src/checker.c
parent584869730a4ad5fb4021d46a6e1dab21790c9452 (diff)
Linker on MacOS and GNU/Linux now includes foreign_system_libraries. Fixed foreign_system_library not respecting 'when' condition.
Diffstat (limited to 'src/checker.c')
-rw-r--r--src/checker.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/checker.c b/src/checker.c
index 12915197a..6b2bac628 100644
--- a/src/checker.c
+++ b/src/checker.c
@@ -1488,6 +1488,19 @@ void check_collect_entities(Checker *c, AstNodeArray nodes, bool is_file_scope)
continue;
}
+ if (fl->cond != NULL) {
+ Operand operand = {Addressing_Invalid};
+ check_expr(c, &operand, fl->cond);
+ if (operand.mode != Addressing_Constant || !is_type_boolean(operand.type)) {
+ error_node(fl->cond, "Non-constant boolean `when` condition");
+ continue;
+ }
+ if (operand.value.kind == ExactValue_Bool &&
+ !operand.value.value_bool) {
+ continue;
+ }
+ }
+
DelayedDecl di = {c->context.scope, decl};
array_add(&c->delayed_foreign_libraries, di);
case_end;
@@ -1853,6 +1866,3 @@ void check_parsed_files(Checker *c) {
map_scope_destroy(&file_scopes);
}
-
-
-