diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-10-20 01:13:39 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-10-20 01:13:39 -0400 |
| commit | a9a6f77a1f0a6e173d85fee42aec0a8d5e22a64d (patch) | |
| tree | b296c79800a216da4a9caa1c335be78d5f2ebd70 /src/ir.cpp | |
| parent | 682511d1b22d50a77ff967d1d6415a68560cd49a (diff) | |
| download | zig-a9a6f77a1f0a6e173d85fee42aec0a8d5e22a64d.tar.gz zig-a9a6f77a1f0a6e173d85fee42aec0a8d5e22a64d.zip | |
add variable declaration initialization IR
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 4d9eacb6c3..b70360f1ad 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -586,9 +586,6 @@ static VariableTableEntry *ir_add_local_var(IrBuilder *irb, AstNode *node, Buf * // TODO replace _anon with @anon and make sure all tests still pass buf_init_from_str(&variable_entry->name, "_anon"); } - if (node->block_context->fn_entry) { - node->block_context->fn_entry->variable_list.append(variable_entry); - } variable_entry->is_const = is_const; variable_entry->decl_node = node; @@ -2177,6 +2174,10 @@ static TypeTableEntry *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstruc } ir_build_var_decl_from(&ira->new_irb, &decl_var_instruction->base, var, var_type, casted_init_value); + BlockContext *scope = decl_var_instruction->base.source_node->block_context; + if (scope->fn_entry) + scope->fn_entry->variable_list.append(var); + return ira->codegen->builtin_types.entry_void; } |
