mirror of
https://github.com/danbulant/oxc
synced 2026-05-25 04:42:10 +00:00
parent
55bbde2888
commit
3967a15b60
2 changed files with 7 additions and 5 deletions
|
|
@ -69,6 +69,7 @@ function generateWalkForStruct(type, types) {
|
||||||
`\`visited_node\` attr says to enter scope before field '${enterFieldName}' `
|
`\`visited_node\` attr says to enter scope before field '${enterFieldName}' `
|
||||||
+ `in '${type.name}', but that field is not visited`
|
+ `in '${type.name}', but that field is not visited`
|
||||||
);
|
);
|
||||||
|
if (scopeEnterField === visitedFields[0]) scopeEnterField = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Maybe this isn't quite right. `scope_id` fields are `Cell<Option<ScopeId>>`,
|
// TODO: Maybe this isn't quite right. `scope_id` fields are `Cell<Option<ScopeId>>`,
|
||||||
|
|
@ -203,8 +204,9 @@ function generateWalkForStruct(type, types) {
|
||||||
${enterScopeCode}
|
${enterScopeCode}
|
||||||
traverser.enter_${typeSnakeName}(&mut *node, ctx);
|
traverser.enter_${typeSnakeName}(&mut *node, ctx);
|
||||||
${fieldsCodes.join('\n')}
|
${fieldsCodes.join('\n')}
|
||||||
|
${enterScopeCode ? '' : exitScopeCode}
|
||||||
traverser.exit_${typeSnakeName}(&mut *node, ctx);
|
traverser.exit_${typeSnakeName}(&mut *node, ctx);
|
||||||
${exitScopeCode}
|
${enterScopeCode ? exitScopeCode : ''}
|
||||||
}
|
}
|
||||||
`.replace(/\n\s*\n+/g, '\n');
|
`.replace(/\n\s*\n+/g, '\n');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1934,10 +1934,10 @@ pub(crate) unsafe fn walk_switch_statement<'a, Tr: Traverse<'a>>(
|
||||||
walk_switch_case(traverser, item as *mut _, ctx);
|
walk_switch_case(traverser, item as *mut _, ctx);
|
||||||
}
|
}
|
||||||
ctx.pop_stack();
|
ctx.pop_stack();
|
||||||
traverser.exit_switch_statement(&mut *node, ctx);
|
|
||||||
if let Some(previous_scope_id) = previous_scope_id {
|
if let Some(previous_scope_id) = previous_scope_id {
|
||||||
ctx.set_current_scope_id(previous_scope_id);
|
ctx.set_current_scope_id(previous_scope_id);
|
||||||
}
|
}
|
||||||
|
traverser.exit_switch_statement(&mut *node, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) unsafe fn walk_switch_case<'a, Tr: Traverse<'a>>(
|
pub(crate) unsafe fn walk_switch_case<'a, Tr: Traverse<'a>>(
|
||||||
|
|
@ -2503,10 +2503,10 @@ pub(crate) unsafe fn walk_class<'a, Tr: Traverse<'a>>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ctx.pop_stack();
|
ctx.pop_stack();
|
||||||
traverser.exit_class(&mut *node, ctx);
|
|
||||||
if let Some(previous_scope_id) = previous_scope_id {
|
if let Some(previous_scope_id) = previous_scope_id {
|
||||||
ctx.set_current_scope_id(previous_scope_id);
|
ctx.set_current_scope_id(previous_scope_id);
|
||||||
}
|
}
|
||||||
|
traverser.exit_class(&mut *node, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) unsafe fn walk_class_body<'a, Tr: Traverse<'a>>(
|
pub(crate) unsafe fn walk_class_body<'a, Tr: Traverse<'a>>(
|
||||||
|
|
@ -3644,10 +3644,10 @@ pub(crate) unsafe fn walk_ts_enum_declaration<'a, Tr: Traverse<'a>>(
|
||||||
walk_ts_enum_member(traverser, item as *mut _, ctx);
|
walk_ts_enum_member(traverser, item as *mut _, ctx);
|
||||||
}
|
}
|
||||||
ctx.pop_stack();
|
ctx.pop_stack();
|
||||||
traverser.exit_ts_enum_declaration(&mut *node, ctx);
|
|
||||||
if let Some(previous_scope_id) = previous_scope_id {
|
if let Some(previous_scope_id) = previous_scope_id {
|
||||||
ctx.set_current_scope_id(previous_scope_id);
|
ctx.set_current_scope_id(previous_scope_id);
|
||||||
}
|
}
|
||||||
|
traverser.exit_ts_enum_declaration(&mut *node, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) unsafe fn walk_ts_enum_member<'a, Tr: Traverse<'a>>(
|
pub(crate) unsafe fn walk_ts_enum_member<'a, Tr: Traverse<'a>>(
|
||||||
|
|
@ -4842,10 +4842,10 @@ pub(crate) unsafe fn walk_ts_module_declaration<'a, Tr: Traverse<'a>>(
|
||||||
walk_ts_module_declaration_body(traverser, field as *mut _, ctx);
|
walk_ts_module_declaration_body(traverser, field as *mut _, ctx);
|
||||||
}
|
}
|
||||||
ctx.pop_stack();
|
ctx.pop_stack();
|
||||||
traverser.exit_ts_module_declaration(&mut *node, ctx);
|
|
||||||
if let Some(previous_scope_id) = previous_scope_id {
|
if let Some(previous_scope_id) = previous_scope_id {
|
||||||
ctx.set_current_scope_id(previous_scope_id);
|
ctx.set_current_scope_id(previous_scope_id);
|
||||||
}
|
}
|
||||||
|
traverser.exit_ts_module_declaration(&mut *node, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) unsafe fn walk_ts_module_declaration_name<'a, Tr: Traverse<'a>>(
|
pub(crate) unsafe fn walk_ts_module_declaration_name<'a, Tr: Traverse<'a>>(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue