implement iterateChildren on asm
This commit is contained in:
21
src/ast.zig
21
src/ast.zig
@@ -1176,6 +1176,8 @@ pub fn iterateChildren(
|
||||
) Error!void {
|
||||
const node_tags = tree.nodes.items(.tag);
|
||||
const node_data = tree.nodes.items(.data);
|
||||
const main_tokens = tree.nodes.items(.main_token);
|
||||
const token_tags = tree.tokens.items(.tag);
|
||||
|
||||
if (node > tree.nodes.len) return;
|
||||
|
||||
@@ -1494,16 +1496,25 @@ pub fn iterateChildren(
|
||||
},
|
||||
|
||||
.@"asm" => {
|
||||
const asm_ast = tree.asmFull(node).ast;
|
||||
try callback(context, tree, asm_ast.template);
|
||||
for (asm_ast.items) |child| {
|
||||
try callback(context, tree, child);
|
||||
const asm_node = tree.asmFull(node);
|
||||
|
||||
try callback(context, tree, asm_node.ast.template);
|
||||
|
||||
for (asm_node.outputs) |output_node| {
|
||||
const has_arrow = token_tags[main_tokens[output_node] + 4] == .arrow;
|
||||
if (has_arrow) {
|
||||
try callback(context, tree, node_data[output_node].lhs);
|
||||
}
|
||||
}
|
||||
|
||||
for (asm_node.inputs) |input_node| {
|
||||
try callback(context, tree, node_data[input_node].lhs);
|
||||
}
|
||||
},
|
||||
|
||||
.asm_output,
|
||||
.asm_input,
|
||||
=> {}, // TODO
|
||||
=> unreachable,
|
||||
|
||||
.@"continue",
|
||||
.anyframe_literal,
|
||||
|
||||
Reference in New Issue
Block a user