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 token_tags = tree.tokens.items(.tag);
|
||||||
const main_token = tree.nodes.items(.main_token)[container];
|
const main_token = tree.nodes.items(.main_token)[container];
|
||||||
|
|
||||||
const is_enum = if (isContainer(node_tags[container]) and node_tags[container] != .root)
|
const is_enum = token_tags[main_token] == .keyword_enum;
|
||||||
token_tags[main_token] == .keyword_enum
|
|
||||||
else
|
const container_scope = findContainerScope(container_handle) orelse return;
|
||||||
false;
|
|
||||||
|
|
||||||
if (findContainerScope(container_handle)) |container_scope| {
|
|
||||||
var decl_it = container_scope.decls.iterator();
|
var decl_it = container_scope.decls.iterator();
|
||||||
while (decl_it.next()) |entry| {
|
while (decl_it.next()) |entry| {
|
||||||
switch (entry.value) {
|
switch (entry.value) {
|
||||||
@ -2148,20 +2146,16 @@ fn iterateSymbolsContainerInternal(
|
|||||||
if (std.mem.indexOfScalar(ast.Node.Index, use_trail.items, use) != null) continue;
|
if (std.mem.indexOfScalar(ast.Node.Index, use_trail.items, use) != null) continue;
|
||||||
try use_trail.append(use);
|
try use_trail.append(use);
|
||||||
|
|
||||||
const rhs = tree.nodes.items(.data)[use].rhs;
|
const lhs = tree.nodes.items(.data)[use].lhs;
|
||||||
// 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 use_expr = (try resolveTypeOfNode(store, arena, .{
|
const use_expr = (try resolveTypeOfNode(store, arena, .{
|
||||||
.node = tree.nodes.items(.data)[use].rhs,
|
.node = lhs,
|
||||||
.handle = orig_handle,
|
.handle = handle,
|
||||||
})) orelse continue;
|
})) orelse continue;
|
||||||
|
|
||||||
const use_expr_node = switch (use_expr.type.data) {
|
const use_expr_node = switch (use_expr.type.data) {
|
||||||
.other => |n| n,
|
.other => |n| n,
|
||||||
else => continue,
|
else => continue,
|
||||||
};
|
};
|
||||||
|
|
||||||
try iterateSymbolsContainerInternal(
|
try iterateSymbolsContainerInternal(
|
||||||
store,
|
store,
|
||||||
arena,
|
arena,
|
||||||
@ -2174,7 +2168,6 @@ fn iterateSymbolsContainerInternal(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
pub fn iterateSymbolsContainer(
|
pub fn iterateSymbolsContainer(
|
||||||
store: *DocumentStore,
|
store: *DocumentStore,
|
||||||
@ -2232,12 +2225,25 @@ fn iterateSymbolsGlobalInternal(
|
|||||||
if (std.mem.indexOfScalar(ast.Node.Index, use_trail.items, use) != null) continue;
|
if (std.mem.indexOfScalar(ast.Node.Index, use_trail.items, use) != null) continue;
|
||||||
try use_trail.append(use);
|
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) {
|
const use_expr_node = switch (use_expr.type.data) {
|
||||||
.other => |n| n,
|
.other => |n| n,
|
||||||
else => continue,
|
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