aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-04-20 02:15:09 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-04-20 02:15:09 -0400
commit6e57243a79b08f37b80122f0eb24d073d6e2e95c (patch)
treec1b95d61998034b50b558c94f81141eaae8409e0 /src/ir.cpp
parentcc35f085cad8a8da1b08ecaf6681f097aca7b604 (diff)
downloadzig-6e57243a79b08f37b80122f0eb24d073d6e2e95c.tar.gz
zig-6e57243a79b08f37b80122f0eb24d073d6e2e95c.zip
zig fmt: preserve comments in front of test blocks
* refactor std.zig.parser * fix compiler crashing for some compile errors * take advantage of @field in std.zig.ast * move ast.NodeFoo to ast.Node.Foo * comment preservation is more explicit See #911
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index a34c990afe..865a6823be 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -6523,6 +6523,8 @@ static IrInstruction *ir_gen_node_raw(IrBuilder *irb, AstNode *node, Scope *scop
case NodeTypeFieldAccessExpr:
{
IrInstruction *ptr_instruction = ir_gen_field_access(irb, scope, node);
+ if (ptr_instruction == irb->codegen->invalid_instruction)
+ return ptr_instruction;
if (lval.is_ptr)
return ptr_instruction;
@@ -15556,6 +15558,8 @@ static TypeTableEntry *ir_analyze_instruction_field_parent_ptr(IrAnalyze *ira,
}
ensure_complete_type(ira->codegen, container_type);
+ if (type_is_invalid(container_type))
+ return ira->codegen->builtin_types.entry_invalid;
TypeStructField *field = find_struct_type_field(container_type, field_name);
if (field == nullptr) {