Skip to content

Commit

Permalink
Parser: remove else branch from complex initializer handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ehaas committed Mar 6, 2024
1 parent d66d6f9 commit d229c58
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/aro/Parser.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3334,17 +3334,16 @@ fn initializer(p: *Parser, init_ty: Type) Error!Result {

if (init_ty.isComplex()) {
return p.complexInitializer(init_ty);
} else {
var il: InitList = .{};
defer il.deinit(p.gpa);
}
var il: InitList = .{};
defer il.deinit(p.gpa);

_ = try p.initializerItem(&il, init_ty);
_ = try p.initializerItem(&il, init_ty);

const res = try p.convertInitList(il, init_ty);
var res_ty = p.nodes.items(.ty)[@intFromEnum(res)];
res_ty.qual = init_ty.qual;
return Result{ .ty = res_ty, .node = res };
}
const res = try p.convertInitList(il, init_ty);
var res_ty = p.nodes.items(.ty)[@intFromEnum(res)];
res_ty.qual = init_ty.qual;
return Result{ .ty = res_ty, .node = res };
}

/// initializerItems : designation? initializer (',' designation? initializer)* ','?
Expand Down

0 comments on commit d229c58

Please sign in to comment.