Skip to content

Comments

refactor(semantic): ArrowFunctionExpression leave scope before leaving node#12659

Merged
graphite-app[bot] merged 1 commit intomainfrom
07-31-refactor_semantic_arrowfunctionexpression_leave_scope_before_leaving_node
Aug 1, 2025
Merged

refactor(semantic): ArrowFunctionExpression leave scope before leaving node#12659
graphite-app[bot] merged 1 commit intomainfrom
07-31-refactor_semantic_arrowfunctionexpression_leave_scope_before_leaving_node

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Jul 31, 2025

Bring Visit::visit_arrow_function_expression in SemanticBuilder in line with walk_arrow_function_expression - leave scope before leaving node:

pub fn walk_arrow_function_expression<'a, V: Visit<'a>>(
visitor: &mut V,
it: &ArrowFunctionExpression<'a>,
) {
let kind = AstKind::ArrowFunctionExpression(visitor.alloc(it));
visitor.enter_node(kind);
visitor.enter_scope(
{
let mut flags = ScopeFlags::Function | ScopeFlags::Arrow;
if it.has_use_strict_directive() {
flags |= ScopeFlags::StrictMode;
}
flags
},
&it.scope_id,
);
visitor.visit_span(&it.span);
if let Some(type_parameters) = &it.type_parameters {
visitor.visit_ts_type_parameter_declaration(type_parameters);
}
visitor.visit_formal_parameters(&it.params);
if let Some(return_type) = &it.return_type {
visitor.visit_ts_type_annotation(return_type);
}
visitor.visit_function_body(&it.body);
visitor.leave_scope();
visitor.leave_node(kind);
}

The order of calls makes no difference to logic in this case, but it's the only place where we had leave_scope and leave_node in opposite order in SemanticBuilder's visitor. It's better to be consistent.

Copy link
Member Author

overlookmotel commented Jul 31, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added A-semantic Area - Semantic C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Jul 31, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Jul 31, 2025

CodSpeed Instrumentation Performance Report

Merging #12659 will not alter performance

Comparing 07-31-refactor_semantic_arrowfunctionexpression_leave_scope_before_leaving_node (6a1c7c6) with main (d7a3e03)

Summary

✅ 34 untouched benchmarks

@overlookmotel overlookmotel marked this pull request as ready for review July 31, 2025 09:47
@overlookmotel overlookmotel requested a review from Dunqing as a code owner July 31, 2025 09:47
@graphite-app graphite-app bot changed the base branch from 07-31-refactor_semantic_move_comments to graphite-base/12659 July 31, 2025 09:56
@graphite-app graphite-app bot force-pushed the graphite-base/12659 branch from 3d91446 to e741634 Compare July 31, 2025 10:05
@graphite-app graphite-app bot force-pushed the 07-31-refactor_semantic_arrowfunctionexpression_leave_scope_before_leaving_node branch from a2da430 to abce173 Compare July 31, 2025 10:05
@graphite-app graphite-app bot changed the base branch from graphite-base/12659 to main July 31, 2025 10:06
@graphite-app graphite-app bot force-pushed the 07-31-refactor_semantic_arrowfunctionexpression_leave_scope_before_leaving_node branch from abce173 to feaaf9a Compare July 31, 2025 10:06
@overlookmotel overlookmotel force-pushed the 07-31-refactor_semantic_arrowfunctionexpression_leave_scope_before_leaving_node branch from feaaf9a to 34e6b0f Compare August 1, 2025 12:44
@overlookmotel
Copy link
Member Author

After other recent PRs, this PR now only moves 1 line. I'm going to merge without review.

@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Aug 1, 2025
Copy link
Member Author

overlookmotel commented Aug 1, 2025

Merge activity

…ing node (#12659)

Bring `Visit::visit_arrow_function_expression` in `SemanticBuilder` in line with `walk_arrow_function_expression` - leave scope before leaving node:

https://github.com/oxc-project/oxc/blob/fc4a327d464f2de5a387e1f7f0718bbcd32d7ac2/crates/oxc_ast_visit/src/generated/visit.rs#L2490-L2517

The order of calls makes no difference to logic in this case, but it's the only place where we had `leave_scope` and `leave_node` in opposite order in `SemanticBuilder`'s visitor. It's better to be consistent.
@graphite-app graphite-app bot force-pushed the 07-31-refactor_semantic_arrowfunctionexpression_leave_scope_before_leaving_node branch from 34e6b0f to 6a1c7c6 Compare August 1, 2025 21:14
@graphite-app graphite-app bot merged commit 6a1c7c6 into main Aug 1, 2025
24 checks passed
@graphite-app graphite-app bot deleted the 07-31-refactor_semantic_arrowfunctionexpression_leave_scope_before_leaving_node branch August 1, 2025 21:22
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Aug 1, 2025
Copilot AI pushed a commit that referenced this pull request Aug 2, 2025
…ing node (#12659)

Bring `Visit::visit_arrow_function_expression` in `SemanticBuilder` in line with `walk_arrow_function_expression` - leave scope before leaving node:

https://github.com/oxc-project/oxc/blob/fc4a327d464f2de5a387e1f7f0718bbcd32d7ac2/crates/oxc_ast_visit/src/generated/visit.rs#L2490-L2517

The order of calls makes no difference to logic in this case, but it's the only place where we had `leave_scope` and `leave_node` in opposite order in `SemanticBuilder`'s visitor. It's better to be consistent.
Copilot AI pushed a commit that referenced this pull request Aug 2, 2025
…ing node (#12659)

Bring `Visit::visit_arrow_function_expression` in `SemanticBuilder` in line with `walk_arrow_function_expression` - leave scope before leaving node:

https://github.com/oxc-project/oxc/blob/fc4a327d464f2de5a387e1f7f0718bbcd32d7ac2/crates/oxc_ast_visit/src/generated/visit.rs#L2490-L2517

The order of calls makes no difference to logic in this case, but it's the only place where we had `leave_scope` and `leave_node` in opposite order in `SemanticBuilder`'s visitor. It's better to be consistent.
Copilot AI pushed a commit that referenced this pull request Aug 2, 2025
…ing node (#12659)

Bring `Visit::visit_arrow_function_expression` in `SemanticBuilder` in line with `walk_arrow_function_expression` - leave scope before leaving node:

https://github.com/oxc-project/oxc/blob/fc4a327d464f2de5a387e1f7f0718bbcd32d7ac2/crates/oxc_ast_visit/src/generated/visit.rs#L2490-L2517

The order of calls makes no difference to logic in this case, but it's the only place where we had `leave_scope` and `leave_node` in opposite order in `SemanticBuilder`'s visitor. It's better to be consistent.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-semantic Area - Semantic C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant