Resovle parens, only skip empty container fields where we have to
This commit is contained in:
parent
28e9d08f03
commit
693e810d75
@ -381,6 +381,10 @@ pub fn resolveTypeOfNode(store: *DocumentStore, arena: *std.heap.ArenaAllocator,
|
|||||||
}
|
}
|
||||||
return decl;
|
return decl;
|
||||||
},
|
},
|
||||||
|
.GroupedExpression => {
|
||||||
|
const grouped = node.cast(ast.Node.GroupedExpression).?;
|
||||||
|
return try resolveTypeOfNode(store, arena, .{ .node = grouped.expr, .handle = handle });
|
||||||
|
},
|
||||||
.StructInitializer => {
|
.StructInitializer => {
|
||||||
const struct_init = node.cast(ast.Node.StructInitializer).?;
|
const struct_init = node.cast(ast.Node.StructInitializer).?;
|
||||||
return try resolveTypeOfNode(store, arena, .{ .node = struct_init.lhs, .handle = handle });
|
return try resolveTypeOfNode(store, arena, .{ .node = struct_init.lhs, .handle = handle });
|
||||||
@ -430,6 +434,13 @@ pub fn resolveTypeOfNode(store: *DocumentStore, arena: *std.heap.ArenaAllocator,
|
|||||||
})) orelse return null;
|
})) orelse return null;
|
||||||
return try resolveUnwrapOptionalType(store, arena, left_type);
|
return try resolveUnwrapOptionalType(store, arena, left_type);
|
||||||
},
|
},
|
||||||
|
.Catch => {
|
||||||
|
const left_type = (try resolveTypeOfNode(store, arena, .{
|
||||||
|
.node = infix_op.lhs,
|
||||||
|
.handle = handle,
|
||||||
|
})) orelse return null;
|
||||||
|
return try resolveUnwrapErrorType(store, arena, left_type);
|
||||||
|
},
|
||||||
.ErrorUnion => return node_handle,
|
.ErrorUnion => return node_handle,
|
||||||
else => return null,
|
else => return null,
|
||||||
}
|
}
|
||||||
@ -1305,9 +1316,15 @@ fn makeScopeInternal(
|
|||||||
|
|
||||||
if (decl.cast(ast.Node.ContainerField)) |field| {
|
if (decl.cast(ast.Node.ContainerField)) |field| {
|
||||||
if (field.type_expr == null and field.value_expr == null) {
|
if (field.type_expr == null and field.value_expr == null) {
|
||||||
|
if (node.id == .Root) continue;
|
||||||
|
if (node.cast(ast.Node.ContainerDecl)) |container| {
|
||||||
|
const kind = tree.token_ids[container.kind_token];
|
||||||
|
if (kind == .Keyword_struct or (kind == .Keyword_union and container.init_arg_expr == .None)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (try scopes.items[scope_idx].decls.put(name, .{ .ast_node = decl })) |existing| {
|
if (try scopes.items[scope_idx].decls.put(name, .{ .ast_node = decl })) |existing| {
|
||||||
// TODO Record a redefinition error.
|
// TODO Record a redefinition error.
|
||||||
|
Loading…
Reference in New Issue
Block a user