diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-10-29 19:24:59 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-10-29 19:24:59 -0400 |
| commit | 56cdaff9e71c10eb9c4dd130ee2516acacc1c13f (patch) | |
| tree | 7a93d1f91bcb3fd580c9667e728273bf8ce694db /src/analyze.cpp | |
| parent | afc5507b6469c9963db8e00efc5648f8e682cf02 (diff) | |
| download | zig-56cdaff9e71c10eb9c4dd130ee2516acacc1c13f.tar.gz zig-56cdaff9e71c10eb9c4dd130ee2516acacc1c13f.zip | |
ir: support return expression
Diffstat (limited to 'src/analyze.cpp')
| -rw-r--r-- | src/analyze.cpp | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index cb64010aa9..d67937a7a5 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -4970,11 +4970,6 @@ static TypeTableEntry *analyze_switch_expr(CodeGen *g, ImportTableEntry *import, static TypeTableEntry *analyze_return_expr(CodeGen *g, ImportTableEntry *import, BlockContext *context, TypeTableEntry *expected_type, AstNode *node) { - if (!context->fn_entry) { - add_node_error(g, node, buf_sprintf("return expression outside function definition")); - return g->builtin_types.entry_invalid; - } - if (!node->data.return_expr.expr) { node->data.return_expr.expr = create_ast_void_node(g, import, node); normalize_parent_ptrs(node); @@ -4984,11 +4979,7 @@ static TypeTableEntry *analyze_return_expr(CodeGen *g, ImportTableEntry *import, switch (node->data.return_expr.kind) { case ReturnKindUnconditional: - { - analyze_expression(g, import, context, expected_return_type, node->data.return_expr.expr); - - return g->builtin_types.entry_unreachable; - } + zig_panic("TODO moved to ir.cpp"); case ReturnKindError: { TypeTableEntry *expected_err_type; |
