Fix namespaces in containers
This commit is contained in:
parent
85937d48ca
commit
094b31be48
@ -2117,12 +2117,10 @@ fn iterateSymbolsContainerInternal(
|
||||
const token_tags = tree.tokens.items(.tag);
|
||||
const main_token = tree.nodes.items(.main_token)[container];
|
||||
|
||||
const is_enum = if (isContainer(node_tags[container]) and node_tags[container] != .root)
|
||||
token_tags[main_token] == .keyword_enum
|
||||
else
|
||||
false;
|
||||
const is_enum = token_tags[main_token] == .keyword_enum;
|
||||
|
||||
const container_scope = findContainerScope(container_handle) orelse return;
|
||||
|
||||
if (findContainerScope(container_handle)) |container_scope| {
|
||||
var decl_it = container_scope.decls.iterator();
|
||||
while (decl_it.next()) |entry| {
|
||||
switch (entry.value) {
|
||||
@ -2148,20 +2146,16 @@ fn iterateSymbolsContainerInternal(
|
||||
if (std.mem.indexOfScalar(ast.Node.Index, use_trail.items, use) != null) continue;
|
||||
try use_trail.append(use);
|
||||
|
||||
const rhs = tree.nodes.items(.data)[use].rhs;
|
||||
// rhs can be invalid so apply the following check to ensure
|
||||
// we do not go out of bounds when resolving the type
|
||||
if (rhs == 0 or rhs > tree.nodes.len) continue;
|
||||
const lhs = tree.nodes.items(.data)[use].lhs;
|
||||
const use_expr = (try resolveTypeOfNode(store, arena, .{
|
||||
.node = tree.nodes.items(.data)[use].rhs,
|
||||
.handle = orig_handle,
|
||||
.node = lhs,
|
||||
.handle = handle,
|
||||
})) orelse continue;
|
||||
|
||||
const use_expr_node = switch (use_expr.type.data) {
|
||||
.other => |n| n,
|
||||
else => continue,
|
||||
};
|
||||
|
||||
try iterateSymbolsContainerInternal(
|
||||
store,
|
||||
arena,
|
||||
@ -2173,7 +2167,6 @@ fn iterateSymbolsContainerInternal(
|
||||
use_trail,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn iterateSymbolsContainer(
|
||||
@ -2232,12 +2225,25 @@ fn iterateSymbolsGlobalInternal(
|
||||
if (std.mem.indexOfScalar(ast.Node.Index, use_trail.items, use) != null) continue;
|
||||
try use_trail.append(use);
|
||||
|
||||
const use_expr = (try resolveTypeOfNode(store, arena, .{ .node = handle.tree.nodes.items(.data)[use].lhs, .handle = handle })) orelse continue;
|
||||
const use_expr = (try resolveTypeOfNode(
|
||||
store,
|
||||
arena,
|
||||
.{ .node = handle.tree.nodes.items(.data)[use].lhs, .handle = handle },
|
||||
)) orelse continue;
|
||||
const use_expr_node = switch (use_expr.type.data) {
|
||||
.other => |n| n,
|
||||
else => continue,
|
||||
};
|
||||
try iterateSymbolsContainerInternal(store, arena, .{ .node = use_expr_node, .handle = use_expr.handle }, handle, callback, context, false, use_trail);
|
||||
try iterateSymbolsContainerInternal(
|
||||
store,
|
||||
arena,
|
||||
.{ .node = use_expr_node, .handle = use_expr.handle },
|
||||
handle,
|
||||
callback,
|
||||
context,
|
||||
false,
|
||||
use_trail,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user