-
-
Notifications
You must be signed in to change notification settings - Fork 933
Closed
Labels
A-transformerArea - Transformer / TranspilerArea - Transformer / TranspilerC-bugCategory - BugCategory - Bug
Description
While reviewing #7113, I was confused by the logic in get_arrow_function_scope. Previously this function returned the ScopeId of enclosing arrow function (as the function's name suggests). But now it also returns the ScopeId of a class method or object method:
oxc/crates/oxc_transformer/src/common/arrow_function_converter.rs
Lines 399 to 409 in b57d5a5
| Ancestor::FunctionBody(func) => { | |
| return if self.is_async_only() && *func.r#async() | |
| && matches!( | |
| ancestors.next().unwrap(), | |
| Ancestor::MethodDefinitionValue(_) | Ancestor::ObjectPropertyValue(_) | |
| ) { | |
| Some(func.scope_id().get().unwrap()) | |
| } else { | |
| None | |
| } | |
| } |
Is this correct?
If it is correct, the name of the function should probably be changed to reflect what it's now doing, and a comment added explaining why.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-transformerArea - Transformer / TranspilerArea - Transformer / TranspilerC-bugCategory - BugCategory - Bug
Type
Fields
Give feedbackPriority
None yet