diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-05-11 15:58:00 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-05-11 15:58:00 -0700 |
| commit | 1eafc85f1f0643ca2594247615a14b7a34343a14 (patch) | |
| tree | d72e400d60d3ef09aaf60b54ba69b15fe7ee3ae4 /src/analyze.cpp | |
| parent | 26718a619c572602c21c83b1588e50723447709a (diff) | |
| download | zig-1eafc85f1f0643ca2594247615a14b7a34343a14.tar.gz zig-1eafc85f1f0643ca2594247615a14b7a34343a14.zip | |
add readonly attribute to relevant functions and parameters
Diffstat (limited to 'src/analyze.cpp')
| -rw-r--r-- | src/analyze.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index b7f325bde3..5eb1be4381 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -1060,7 +1060,7 @@ static void resolve_function_proto(CodeGen *g, AstNode *node, FnTableEntry *fn_t bool ok = resolve_const_expr_bool(g, import, import->block_context, &directive_node->data.directive.expr, &enable); if (!enable || !ok) { - fn_table_entry->is_pure = false; + fn_table_entry->want_pure = WantPureFalse; } // TODO cause compile error if enable is true and impure fn } @@ -5153,7 +5153,7 @@ static TypeTableEntry *analyze_fn_call_ptr(CodeGen *g, ImportTableEntry *import, FnTableEntry *fn_table_entry = node->data.fn_call_expr.fn_entry; ConstExprValue *result_val = &get_resolved_expr(node)->const_val; - if (ok_invocation && fn_table_entry && fn_table_entry->is_pure) { + if (ok_invocation && fn_table_entry && fn_table_entry->is_pure && fn_table_entry->want_pure != WantPureFalse) { if (fn_table_entry->anal_state == FnAnalStateReady) { analyze_fn_body(g, fn_table_entry); } @@ -5167,7 +5167,7 @@ static TypeTableEntry *analyze_fn_call_ptr(CodeGen *g, ImportTableEntry *import, } } } - if (!ok_invocation || !fn_table_entry || !fn_table_entry->is_pure) { + if (!ok_invocation || !fn_table_entry || !fn_table_entry->is_pure || fn_table_entry->want_pure == WantPureFalse) { // calling an impure fn is impure mark_impure_fn(context); } |
