remove TODO's about redefinition errors i favor of ast-check
This commit is contained in:
parent
419527a40d
commit
53c7e5bed7
@ -2532,10 +2532,7 @@ fn makeInnerScope(context: ScopeContext, node_idx: Ast.Node.Index) error{OutOfMe
|
|||||||
try tests.append(allocator, decl);
|
try tests.append(allocator, decl);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (try scopes.items(.decls)[scope_index].fetchPut(allocator, name, .{ .ast_node = decl })) |existing| {
|
try scopes.items(.decls)[scope_index].put(allocator, name, .{ .ast_node = decl });
|
||||||
_ = existing;
|
|
||||||
// TODO Record a redefinition error.
|
|
||||||
}
|
|
||||||
|
|
||||||
if (container_decl.ast.enum_token != null) {
|
if (container_decl.ast.enum_token != null) {
|
||||||
if (std.mem.eql(u8, name, "_")) return;
|
if (std.mem.eql(u8, name, "_")) return;
|
||||||
@ -2602,9 +2599,7 @@ fn makeScopeInternal(context: ScopeContext, node_idx: Ast.Node.Index) error{OutO
|
|||||||
.doc_comment, .comma => {},
|
.doc_comment, .comma => {},
|
||||||
.identifier => {
|
.identifier => {
|
||||||
const name = offsets.tokenToSlice(tree, tok_i);
|
const name = offsets.tokenToSlice(tree, tok_i);
|
||||||
if (try scopes.items(.decls)[scope_index].fetchPut(allocator, name, .{ .error_token = tok_i })) |_| {
|
try scopes.items(.decls)[scope_index].put(allocator, name, .{ .error_token = tok_i });
|
||||||
// TODO Record a redefinition error.
|
|
||||||
}
|
|
||||||
const gop = try context.errors.getOrPut(allocator, .{
|
const gop = try context.errors.getOrPut(allocator, .{
|
||||||
.label = name,
|
.label = name,
|
||||||
.kind = .Constant,
|
.kind = .Constant,
|
||||||
@ -2639,14 +2634,11 @@ fn makeScopeInternal(context: ScopeContext, node_idx: Ast.Node.Index) error{OutO
|
|||||||
while (ast.nextFnParam(&it)) |param| {
|
while (ast.nextFnParam(&it)) |param| {
|
||||||
// Add parameter decls
|
// Add parameter decls
|
||||||
if (param.name_token) |name_token| {
|
if (param.name_token) |name_token| {
|
||||||
if (try scopes.items(.decls)[scope_index].fetchPut(
|
try scopes.items(.decls)[scope_index].put(
|
||||||
allocator,
|
allocator,
|
||||||
tree.tokenSlice(name_token),
|
tree.tokenSlice(name_token),
|
||||||
.{ .param_payload = .{ .param = param, .func = node_idx } },
|
.{ .param_payload = .{ .param = param, .func = node_idx } },
|
||||||
)) |existing| {
|
);
|
||||||
_ = existing;
|
|
||||||
// TODO record a redefinition error
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Visit parameter types to pick up any error sets and enum
|
// Visit parameter types to pick up any error sets and enum
|
||||||
// completions
|
// completions
|
||||||
@ -2703,10 +2695,7 @@ fn makeScopeInternal(context: ScopeContext, node_idx: Ast.Node.Index) error{OutO
|
|||||||
try makeScopeInternal(context, idx);
|
try makeScopeInternal(context, idx);
|
||||||
if (tree.fullVarDecl(idx)) |var_decl| {
|
if (tree.fullVarDecl(idx)) |var_decl| {
|
||||||
const name = tree.tokenSlice(var_decl.ast.mut_token + 1);
|
const name = tree.tokenSlice(var_decl.ast.mut_token + 1);
|
||||||
if (try scopes.items(.decls)[scope_index].fetchPut(allocator, name, .{ .ast_node = idx })) |existing| {
|
try scopes.items(.decls)[scope_index].put(allocator, name, .{ .ast_node = idx });
|
||||||
_ = existing;
|
|
||||||
// TODO record a redefinition error.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2800,10 +2789,11 @@ fn makeScopeInternal(context: ScopeContext, node_idx: Ast.Node.Index) error{OutO
|
|||||||
.other,
|
.other,
|
||||||
);
|
);
|
||||||
|
|
||||||
try scopes.items(.decls)[scope_index].putNoClobber(allocator, tree.tokenSlice(label), .{ .label_decl = .{
|
try scopes.items(.decls)[scope_index].putNoClobber(
|
||||||
.label = label,
|
allocator,
|
||||||
.block = while_node.ast.then_expr,
|
tree.tokenSlice(label),
|
||||||
} });
|
.{ .label_decl = .{ .label = label, .block = while_node.ast.then_expr } },
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
defer if (while_node.label_token != null) context.popScope();
|
defer if (while_node.label_token != null) context.popScope();
|
||||||
@ -2833,14 +2823,11 @@ fn makeScopeInternal(context: ScopeContext, node_idx: Ast.Node.Index) error{OutO
|
|||||||
if (token_tags[name_token + 1] == .comma) {
|
if (token_tags[name_token + 1] == .comma) {
|
||||||
const index_token = name_token + 2;
|
const index_token = name_token + 2;
|
||||||
std.debug.assert(token_tags[index_token] == .identifier);
|
std.debug.assert(token_tags[index_token] == .identifier);
|
||||||
if (try scopes.items(.decls)[scope_index].fetchPut(
|
try scopes.items(.decls)[scope_index].put(
|
||||||
allocator,
|
allocator,
|
||||||
tree.tokenSlice(index_token),
|
tree.tokenSlice(index_token),
|
||||||
.{ .array_index = index_token },
|
.{ .array_index = index_token },
|
||||||
)) |existing| {
|
);
|
||||||
_ = existing;
|
|
||||||
// TODO Record a redefinition error
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try makeScopeInternal(context, while_node.ast.then_expr);
|
try makeScopeInternal(context, while_node.ast.then_expr);
|
||||||
@ -2858,7 +2845,11 @@ fn makeScopeInternal(context: ScopeContext, node_idx: Ast.Node.Index) error{OutO
|
|||||||
defer context.popScope();
|
defer context.popScope();
|
||||||
|
|
||||||
const name = tree.tokenSlice(err_token);
|
const name = tree.tokenSlice(err_token);
|
||||||
try scopes.items(.decls)[scope_index].putNoClobber(allocator, name, .{ .ast_node = while_node.ast.else_expr });
|
try scopes.items(.decls)[scope_index].putNoClobber(
|
||||||
|
allocator,
|
||||||
|
name,
|
||||||
|
.{ .ast_node = while_node.ast.else_expr },
|
||||||
|
);
|
||||||
}
|
}
|
||||||
try makeScopeInternal(context, while_node.ast.else_expr);
|
try makeScopeInternal(context, while_node.ast.else_expr);
|
||||||
}
|
}
|
||||||
@ -2878,10 +2869,11 @@ fn makeScopeInternal(context: ScopeContext, node_idx: Ast.Node.Index) error{OutO
|
|||||||
.other,
|
.other,
|
||||||
);
|
);
|
||||||
|
|
||||||
try scopes.items(.decls)[scope_index].putNoClobber(allocator, tree.tokenSlice(label), .{ .label_decl = .{
|
try scopes.items(.decls)[scope_index].putNoClobber(
|
||||||
.label = label,
|
allocator,
|
||||||
.block = for_node.ast.then_expr,
|
tree.tokenSlice(label),
|
||||||
} });
|
.{ .label_decl = .{ .label = label, .block = for_node.ast.then_expr } },
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
defer if (for_node.label_token != null) context.popScope();
|
defer if (for_node.label_token != null) context.popScope();
|
||||||
|
Loading…
Reference in New Issue
Block a user