Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions crates/oxc_semantic/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1611,6 +1611,10 @@ impl<'a> Visit<'a> for SemanticBuilder<'a> {
// so that the correct cfg_ix is associated with the ast node.
let kind = AstKind::Function(self.alloc(func));
self.enter_node(kind);
self.function_stack.push(self.current_node_id);
if func.is_declaration() {
func.bind(self);
}
self.enter_scope(
{
let mut flags = flags;
Expand Down Expand Up @@ -1687,6 +1691,7 @@ impl<'a> Visit<'a> for SemanticBuilder<'a> {

self.leave_scope();
self.leave_node(kind);
self.function_stack.pop();
}

fn visit_arrow_function_expression(&mut self, expr: &ArrowFunctionExpression<'a>) {
Expand All @@ -1705,6 +1710,7 @@ impl<'a> Visit<'a> for SemanticBuilder<'a> {
// so that the correct cfg_ix is associated with the ast node.
let kind = AstKind::ArrowFunctionExpression(self.alloc(expr));
self.enter_node(kind);
self.function_stack.push(self.current_node_id);
self.enter_scope(
{
let mut flags = ScopeFlags::Function | ScopeFlags::Arrow;
Expand Down Expand Up @@ -1767,6 +1773,7 @@ impl<'a> Visit<'a> for SemanticBuilder<'a> {
/* cfg */

self.leave_node(kind);
self.function_stack.pop();
self.leave_scope();
}

Expand Down Expand Up @@ -1954,15 +1961,6 @@ impl<'a> SemanticBuilder<'a> {
AstKind::VariableDeclarator(decl) => {
decl.bind(self);
}
AstKind::Function(func) => {
self.function_stack.push(self.current_node_id);
if func.is_declaration() {
func.bind(self);
}
}
AstKind::ArrowFunctionExpression(_) => {
self.function_stack.push(self.current_node_id);
}

AstKind::ClassBody(body) => {
self.class_table_builder.declare_class_body(
Expand Down Expand Up @@ -2057,9 +2055,6 @@ impl<'a> SemanticBuilder<'a> {

fn leave_kind(&mut self, kind: AstKind<'a>) {
match kind {
AstKind::Function(_) | AstKind::ArrowFunctionExpression(_) => {
self.function_stack.pop();
}
AstKind::CatchParameter(_) => {
self.resolve_references_for_current_scope();
}
Expand Down
Loading