Fix scope creation for label blocks (#1074)
This commit is contained in:
parent
0aacb76743
commit
3586a7858e
@ -2668,7 +2668,6 @@ fn makeScopeInternal(context: ScopeContext, node_idx: Ast.Node.Index) error{OutO
|
||||
},
|
||||
.other,
|
||||
);
|
||||
defer context.popScope();
|
||||
|
||||
try scopes.items(.decls)[scope_index].putNoClobber(allocator, tree.tokenSlice(first_token), .{ .label_decl = .{
|
||||
.label = first_token,
|
||||
@ -2676,6 +2675,8 @@ fn makeScopeInternal(context: ScopeContext, node_idx: Ast.Node.Index) error{OutO
|
||||
} });
|
||||
}
|
||||
|
||||
defer if (token_tags[first_token] == .identifier) context.popScope();
|
||||
|
||||
const scope_index = try context.pushScope(
|
||||
offsets.nodeToLoc(tree, node_idx),
|
||||
.{ .block = node_idx },
|
||||
@ -2785,7 +2786,6 @@ fn makeScopeInternal(context: ScopeContext, node_idx: Ast.Node.Index) error{OutO
|
||||
},
|
||||
.other,
|
||||
);
|
||||
defer context.popScope();
|
||||
|
||||
try scopes.items(.decls)[scope_index].putNoClobber(allocator, tree.tokenSlice(label), .{ .label_decl = .{
|
||||
.label = label,
|
||||
@ -2793,6 +2793,8 @@ fn makeScopeInternal(context: ScopeContext, node_idx: Ast.Node.Index) error{OutO
|
||||
} });
|
||||
}
|
||||
|
||||
defer if (while_node.label_token != null) context.popScope();
|
||||
|
||||
if (while_node.payload_token) |payload| {
|
||||
const scope_index = try context.pushScope(
|
||||
.{
|
||||
@ -2862,7 +2864,6 @@ fn makeScopeInternal(context: ScopeContext, node_idx: Ast.Node.Index) error{OutO
|
||||
},
|
||||
.other,
|
||||
);
|
||||
defer context.popScope();
|
||||
|
||||
try scopes.items(.decls)[scope_index].putNoClobber(allocator, tree.tokenSlice(label), .{ .label_decl = .{
|
||||
.label = label,
|
||||
@ -2870,6 +2871,8 @@ fn makeScopeInternal(context: ScopeContext, node_idx: Ast.Node.Index) error{OutO
|
||||
} });
|
||||
}
|
||||
|
||||
defer if (for_node.label_token != null) context.popScope();
|
||||
|
||||
const scope_index = try context.pushScope(
|
||||
.{
|
||||
.start = offsets.tokenToIndex(tree, for_node.payload_token),
|
||||
|
Loading…
Reference in New Issue
Block a user