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
This commit is contained in:
Andrew Kelley 2018-04-20 02:15:09 -04:00
parent cc35f085ca
commit 6e57243a79
3 changed files with 2169 additions and 2201 deletions

View File

@ -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) {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff