Removed unnecessary copies
This commit is contained in:
parent
e65d3388e4
commit
96672435a7
@ -254,9 +254,7 @@ pub fn resolveTypeOfNode(analysis_ctx: *AnalysisContext, node: *ast.Node) ?*ast.
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
.Identifier => {
|
.Identifier => {
|
||||||
const identifier = std.mem.dupe(&analysis_ctx.arena.allocator, u8, analysis_ctx.tree.getNodeSource(node)) catch return null;
|
if (getChildOfSlice(analysis_ctx.tree, analysis_ctx.scope_nodes, analysis_ctx.tree.getNodeSource(node))) |child| {
|
||||||
|
|
||||||
if (getChildOfSlice(analysis_ctx.tree, analysis_ctx.scope_nodes, identifier)) |child| {
|
|
||||||
return resolveTypeOfNode(analysis_ctx, child);
|
return resolveTypeOfNode(analysis_ctx, child);
|
||||||
} else return null;
|
} else return null;
|
||||||
},
|
},
|
||||||
@ -386,8 +384,7 @@ pub fn getFieldAccessTypeNode(analysis_ctx: *AnalysisContext, tokenizer: *std.zi
|
|||||||
switch (next.id) {
|
switch (next.id) {
|
||||||
.Eof => return current_node,
|
.Eof => return current_node,
|
||||||
.Identifier => {
|
.Identifier => {
|
||||||
const identifier = std.mem.dupe(&analysis_ctx.arena.allocator, u8, tokenizer.buffer[next.start..next.end]) catch return null;
|
if (getChildOfSlice(analysis_ctx.tree, analysis_ctx.scope_nodes, tokenizer.buffer[next.start..next.end])) |child| {
|
||||||
if (getChildOfSlice(analysis_ctx.tree, analysis_ctx.scope_nodes, identifier)) |child| {
|
|
||||||
if (resolveTypeOfNode(analysis_ctx, child)) |node_type| {
|
if (resolveTypeOfNode(analysis_ctx, child)) |node_type| {
|
||||||
current_node = node_type;
|
current_node = node_type;
|
||||||
} else return null;
|
} else return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user