Skip to content

Commit 3787b46

Browse files
committed
u
1 parent 4bfe9c5 commit 3787b46

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

crates/oxc_ast/src/ast/js.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,6 +1390,7 @@ pub struct ReturnStatement<'a> {
13901390
pub struct WithStatement<'a> {
13911391
pub span: Span,
13921392
pub object: Expression<'a>,
1393+
#[scope(enter_before)]
13931394
pub body: Statement<'a>,
13941395
pub scope_id: Cell<Option<ScopeId>>,
13951396
}

crates/oxc_ast_visit/src/generated/visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2254,9 +2254,9 @@ pub mod walk {
22542254
pub fn walk_with_statement<'a, V: Visit<'a>>(visitor: &mut V, it: &WithStatement<'a>) {
22552255
let kind = AstKind::WithStatement(visitor.alloc(it));
22562256
visitor.enter_node(kind);
2257-
visitor.enter_scope(ScopeFlags::empty(), &it.scope_id);
22582257
visitor.visit_span(&it.span);
22592258
visitor.visit_expression(&it.object);
2259+
visitor.enter_scope(ScopeFlags::empty(), &it.scope_id);
22602260
visitor.visit_statement(&it.body);
22612261
visitor.leave_scope();
22622262
visitor.leave_node(kind);

crates/oxc_ast_visit/src/generated/visit_mut.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2312,9 +2312,9 @@ pub mod walk_mut {
23122312
pub fn walk_with_statement<'a, V: VisitMut<'a>>(visitor: &mut V, it: &mut WithStatement<'a>) {
23132313
let kind = AstType::WithStatement;
23142314
visitor.enter_node(kind);
2315-
visitor.enter_scope(ScopeFlags::empty(), &it.scope_id);
23162315
visitor.visit_span(&mut it.span);
23172316
visitor.visit_expression(&mut it.object);
2317+
visitor.enter_scope(ScopeFlags::empty(), &it.scope_id);
23182318
visitor.visit_statement(&mut it.body);
23192319
visitor.leave_scope();
23202320
visitor.leave_node(kind);

crates/oxc_traverse/src/generated/scopes_collector.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,7 @@ impl<'a> Visit<'a> for ChildScopeCollector {
830830

831831
#[inline]
832832
fn visit_with_statement(&mut self, it: &WithStatement<'a>) {
833+
self.visit_expression(&it.object);
833834
self.add_scope(&it.scope_id);
834835
}
835836

crates/oxc_traverse/src/generated/walk.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,12 +1891,6 @@ unsafe fn walk_with_statement<'a, State, Tr: Traverse<'a, State>>(
18911891
ctx: &mut TraverseCtx<'a, State>,
18921892
) {
18931893
traverser.enter_with_statement(&mut *node, ctx);
1894-
let previous_scope_id = ctx.current_scope_id();
1895-
let current_scope_id = (*((node as *mut u8).add(ancestor::OFFSET_WITH_STATEMENT_SCOPE_ID)
1896-
as *mut Cell<Option<ScopeId>>))
1897-
.get()
1898-
.unwrap();
1899-
ctx.set_current_scope_id(current_scope_id);
19001894
let pop_token = ctx.push_stack(Ancestor::WithStatementObject(
19011895
ancestor::WithStatementWithoutObject(node, PhantomData),
19021896
));
@@ -1905,6 +1899,12 @@ unsafe fn walk_with_statement<'a, State, Tr: Traverse<'a, State>>(
19051899
(node as *mut u8).add(ancestor::OFFSET_WITH_STATEMENT_OBJECT) as *mut Expression,
19061900
ctx,
19071901
);
1902+
let previous_scope_id = ctx.current_scope_id();
1903+
let current_scope_id = (*((node as *mut u8).add(ancestor::OFFSET_WITH_STATEMENT_SCOPE_ID)
1904+
as *mut Cell<Option<ScopeId>>))
1905+
.get()
1906+
.unwrap();
1907+
ctx.set_current_scope_id(current_scope_id);
19081908
ctx.retag_stack(AncestorType::WithStatementBody);
19091909
walk_statement(
19101910
traverser,

0 commit comments

Comments
 (0)