@@ -270,7 +270,7 @@ impl<'a> Traverse<'a> for ArrowFunctionConverter<'a> {
270
270
let previous = * self . arguments_needs_transform_stack . last ( ) ;
271
271
self . arguments_needs_transform_stack . push ( previous || arrow. r#async ) ;
272
272
273
- if Self :: if_ancestor_of_class_property_definition_value ( ctx) {
273
+ if Self :: in_class_property_definition_value ( ctx) {
274
274
self . this_var_stack . push ( None ) ;
275
275
self . super_methods_stack . push ( FxIndexMap :: default ( ) ) ;
276
276
}
@@ -285,7 +285,7 @@ impl<'a> Traverse<'a> for ArrowFunctionConverter<'a> {
285
285
ctx : & mut TraverseCtx < ' a > ,
286
286
) {
287
287
if self . is_async_only ( ) {
288
- if Self :: if_ancestor_of_class_property_definition_value ( ctx) {
288
+ if Self :: in_class_property_definition_value ( ctx) {
289
289
let this_var = self . this_var_stack . pop ( ) ;
290
290
let super_methods = self . super_methods_stack . pop ( ) ;
291
291
self . insert_variable_statement_at_the_top_of_statements (
@@ -403,7 +403,7 @@ impl<'a> Traverse<'a> for ArrowFunctionConverter<'a> {
403
403
// TODO: If the async arrow function without `this` or `super` usage, we can skip this step.
404
404
if self . is_async_only ( )
405
405
&& arrow. r#async
406
- && Self :: if_ancestor_of_class_property_definition_value ( ctx)
406
+ && Self :: in_class_property_definition_value ( ctx)
407
407
{
408
408
// Inside class property definition value, since async arrow function will be
409
409
// converted to a generator function by `AsyncToGenerator` plugin, ensure
@@ -681,9 +681,9 @@ impl<'a> ArrowFunctionConverter<'a> {
681
681
}
682
682
}
683
683
684
- /// Check whether the ancestor is an [`Ancestor::PropertyDefinitionValue`],
685
- /// return false if it's reached the statement.
686
- fn if_ancestor_of_class_property_definition_value ( ctx : & mut TraverseCtx < ' a > ) -> bool {
684
+ /// Check whether currently in a class property initializer.
685
+ /// e.g. `x` in `class C { prop = [foo(x)]; }`
686
+ fn in_class_property_definition_value ( ctx : & mut TraverseCtx < ' a > ) -> bool {
687
687
for ancestor in ctx. ancestors ( ) {
688
688
if ancestor. is_parent_of_statement ( ) {
689
689
return false ;
0 commit comments