fn parseGlobalVarDecl(p: *Parse) !?Node.Index p: *Parse878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898fn parseGlobalVarDecl(p: *Parse) !?Node.Index {
const var_decl = try p.parseVarDeclProto() orelse return null;
const init_node: ?Node.Index = switch (p.tokenTag(p.tok_i)) {
.equal_equal => blk: {
try p.warn(.wrong_equal_var_decl);
p.tok_i += 1;
break :blk try p.expectExpr();
},
.equal => blk: {
p.tok_i += 1;
break :blk try p.expectExpr();
},
else => null,
};
p.setVarDeclInitExpr(var_decl, .fromOptional(init_node));
try p.expectSemicolon(.expected_semi_after_decl, false);
return var_decl;
}