@@ -737,8 +737,16 @@ with type t = Impl.t = struct
737737 ?comments
738738 loc
739739 [(" name" , string name); (" typeAnnotation" , null); (" optional" , bool false )]
740- and private_name (loc , { PrivateName. id; comments } ) =
741- node ?comments " PrivateName" loc [(" id" , identifier id)]
740+ and private_identifier
741+ ( loc ,
742+ { PrivateName. id = (_ , { Identifier. name; comments = identifier_comments } ); comments } )
743+ =
744+ let comments = Flow_ast_utils. merge_comments ~outer: comments ~inner: identifier_comments in
745+ node
746+ ?comments
747+ " PrivateIdentifier"
748+ loc
749+ [(" name" , string name); (" typeAnnotation" , null); (" optional" , bool false )]
742750 and pattern_identifier
743751 loc { Pattern.Identifier. name = (_ , { Identifier. name; comments } ); annot; optional } =
744752 node
@@ -939,7 +947,7 @@ with type t = Impl.t = struct
939947 match key with
940948 | Literal lit -> (literal lit, false , comments)
941949 | Identifier id -> (identifier id, false , comments)
942- | PrivateName name -> (private_name name, false , comments)
950+ | PrivateName name -> (private_identifier name, false , comments)
943951 | Computed (_ , { ComputedKey. expression = expr ; comments = computed_comments } ) ->
944952 ( expression expr,
945953 true ,
@@ -966,27 +974,19 @@ with type t = Impl.t = struct
966974 (" decorators" , array_of_list class_decorator decorators);
967975 ]
968976 and class_private_field
969- ( loc ,
970- {
971- Class.PrivateField. key = (_ , { PrivateName. id; comments = key_comments } );
972- value;
973- annot;
974- static;
975- variance = variance_ ;
976- comments;
977- } ) =
977+ (loc , { Class.PrivateField. key; value; annot; static; variance = variance_ ; comments } ) =
978978 let (value, declare) =
979979 match value with
980980 | Class.Property. Declared -> (None , true )
981981 | Class.Property. Uninitialized -> (None , false )
982982 | Class.Property. Initialized x -> (Some x, false )
983983 in
984- let comments = Flow_ast_utils. merge_comments ~outer: comments ~inner: key_comments in
985984 let props =
986985 [
987- (" key" , identifier id );
986+ (" key" , private_identifier key );
988987 (" value" , option expression value);
989988 (" typeAnnotation" , hint type_annotation annot);
989+ (" computed" , bool false );
990990 (" static" , bool static);
991991 (" variance" , option variance variance_);
992992 ]
@@ -996,7 +996,7 @@ with type t = Impl.t = struct
996996 else
997997 []
998998 in
999- node ?comments " ClassPrivateProperty " loc props
999+ node ?comments " PropertyDefinition " loc props
10001000 and class_property
10011001 (loc , { Class.Property. key; value; annot; static; variance = variance_ ; comments } ) =
10021002 let (key, computed, comments) =
@@ -1030,7 +1030,7 @@ with type t = Impl.t = struct
10301030 else
10311031 []
10321032 in
1033- node ?comments " ClassProperty " loc props
1033+ node ?comments " PropertyDefinition " loc props
10341034 and enum_declaration (loc , { Statement.EnumDeclaration. id; body; comments } ) =
10351035 let open Statement.EnumDeclaration in
10361036 let enum_body =
@@ -1887,7 +1887,7 @@ with type t = Impl.t = struct
18871887 let (property, computed) =
18881888 match property with
18891889 | Expression.Member. PropertyIdentifier id -> (identifier id, false )
1890- | Expression.Member. PropertyPrivateName name -> (private_name name, false )
1890+ | Expression.Member. PropertyPrivateName name -> (private_identifier name, false )
18911891 | Expression.Member. PropertyExpression expr -> (expression expr, true )
18921892 in
18931893 [(" object" , expression _object); (" property" , property); (" computed" , bool computed)]
0 commit comments