diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-04-19 20:28:44 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-04-19 20:28:44 -0700 |
| commit | a25307c0a1b45d0c7b83158349fbc57626baf656 (patch) | |
| tree | 3a7035c0f54e29298f8f7330239db6fea5097556 /src/analyze.cpp | |
| parent | 04364c45cefbba9451af202ceab5ae528cc8bbaa (diff) | |
| download | zig-a25307c0a1b45d0c7b83158349fbc57626baf656.tar.gz zig-a25307c0a1b45d0c7b83158349fbc57626baf656.zip | |
add optional continue expression to while loop
closes #139
Diffstat (limited to 'src/analyze.cpp')
| -rw-r--r-- | src/analyze.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index 3a8f0eb6fa..083f4bd2cd 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -3507,10 +3507,15 @@ static TypeTableEntry *analyze_while_expr(CodeGen *g, ImportTableEntry *import, AstNode *condition_node = node->data.while_expr.condition; AstNode *while_body_node = node->data.while_expr.body; + AstNode **continue_expr_node = &node->data.while_expr.continue_expr; TypeTableEntry *condition_type = analyze_expression(g, import, context, g->builtin_types.entry_bool, condition_node); + if (*continue_expr_node) { + analyze_expression(g, import, context, g->builtin_types.entry_void, *continue_expr_node); + } + BlockContext *child_context = new_block_context(node, context); child_context->parent_loop_node = node; |
