oxc/crates
overlookmotel ae692d70df fix(transformer/async_to_generator): fix checking if function is class method (#7117)
Follow-on after #7105.

Correctly identify when a function is a method definition. `ctx.parent().is_method_definition()` would return `true` for this weird case where the function is the property key of the method, not the method itself:

```js
class C {
    [async function() {}]() {}
}
```

`matches!(ctx.parent(), Ancestor::MethodDefinitionValue(_))` only returns `true` if the function *is* a method definition. Of course, no-one would write such ridiculous code, but we may as well handle whatever is thrown at us.

It's also slightly more performant to check for one specific ancestor type, rather than:

c2802e63fc/crates/oxc_traverse/src/generated/ancestor.rs (L1319-L1326)
2024-11-04 15:46:12 +00:00
..
oxc release(crates): v0.35.0 (#7110) 2024-11-04 17:40:05 +08:00
oxc_allocator release(crates): v0.35.0 (#7110) 2024-11-04 17:40:05 +08:00
oxc_ast release(crates): v0.35.0 (#7110) 2024-11-04 17:40:05 +08:00
oxc_ast_macros release(crates): v0.35.0 (#7110) 2024-11-04 17:40:05 +08:00
oxc_cfg release(crates): v0.35.0 (#7110) 2024-11-04 17:40:05 +08:00
oxc_codegen release(crates): v0.35.0 (#7110) 2024-11-04 17:40:05 +08:00
oxc_data_structures release(crates): v0.35.0 (#7110) 2024-11-04 17:40:05 +08:00
oxc_diagnostics release(crates): v0.35.0 (#7110) 2024-11-04 17:40:05 +08:00
oxc_ecmascript release(crates): v0.35.0 (#7110) 2024-11-04 17:40:05 +08:00
oxc_estree release(crates): v0.35.0 (#7110) 2024-11-04 17:40:05 +08:00
oxc_index release(crates): v0.35.0 (#7110) 2024-11-04 17:40:05 +08:00
oxc_isolated_declarations release(crates): v0.35.0 (#7110) 2024-11-04 17:40:05 +08:00
oxc_language_server feat(linter): do not bail for unmatched rules yet (#7093) 2024-11-03 11:18:36 +08:00
oxc_linter fix(linter): fix is_method_call with parentheses and chain expression (#7095) 2024-11-04 11:12:37 +08:00
oxc_macros feat(linter): support user-configurable secrets for oxc-security/api-keys (#5938) 2024-10-28 18:55:19 +00:00
oxc_mangler release(crates): v0.35.0 (#7110) 2024-11-04 17:40:05 +08:00
oxc_minifier release(crates): v0.35.0 (#7110) 2024-11-04 17:40:05 +08:00
oxc_module_lexer release(crates): v0.35.0 (#7110) 2024-11-04 17:40:05 +08:00
oxc_parser release(crates): v0.35.0 (#7110) 2024-11-04 17:40:05 +08:00
oxc_prettier refactor(rust): remove the annoying clippy::wildcard_imports (#6860) 2024-10-24 13:57:19 +00:00
oxc_regular_expression release(crates): v0.35.0 (#7110) 2024-11-04 17:40:05 +08:00
oxc_semantic release(crates): v0.35.0 (#7110) 2024-11-04 17:40:05 +08:00
oxc_sourcemap release(crates): v0.35.0 (#7110) 2024-11-04 17:40:05 +08:00
oxc_span release(crates): v0.35.0 (#7110) 2024-11-04 17:40:05 +08:00
oxc_syntax release(crates): v0.35.0 (#7110) 2024-11-04 17:40:05 +08:00
oxc_transformer fix(transformer/async_to_generator): fix checking if function is class method (#7117) 2024-11-04 15:46:12 +00:00
oxc_traverse release(crates): v0.35.0 (#7110) 2024-11-04 17:40:05 +08:00
oxc_wasm feat(transformer): add TransformerOptions::env with EnvOptions (#7037) 2024-10-31 12:30:32 +00:00