@openrewrite/rewrite 8.65.0-20251023-181533 → 8.65.0-20251024-060457

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -862,11 +862,10 @@ class JavaScriptParserVisitor {
862
862
  methodType: this.mapMethodType(node)
863
863
  };
864
864
  }
865
- let name = !node.name
866
- ? this.mapIdentifier(node, "")
867
- : typescript_1.default.isStringLiteral(node.name)
868
- ? this.mapIdentifier(node.name, node.name.getText())
869
- : this.visit(node.name);
865
+ let name = this.mapMethodName(node);
866
+ name = (0, immer_1.produce)(name, draft => {
867
+ draft.markers = this.maybeAddOptionalMarker(draft, node);
868
+ });
870
869
  return {
871
870
  kind: java_1.J.Kind.MethodDeclaration,
872
871
  id: (0, uuid_1.randomId)(),
@@ -877,9 +876,7 @@ class JavaScriptParserVisitor {
877
876
  typeParameters: this.mapTypeParametersAsObject(node),
878
877
  returnTypeExpression: this.mapTypeInfo(node),
879
878
  nameAnnotations: [],
880
- name: (0, immer_1.produce)(name, draft => {
881
- draft.markers = this.maybeAddOptionalMarker(draft, node);
882
- }),
879
+ name: name,
883
880
  parameters: this.mapCommaSeparatedList(this.getParameterListNodes(node)),
884
881
  methodType: this.mapMethodType(node)
885
882
  };
@@ -895,7 +892,7 @@ class JavaScriptParserVisitor {
895
892
  });
896
893
  }
897
894
  });
898
- let name = node.name ? this.visit(node.name) : this.mapIdentifier(node, "");
895
+ let name = this.mapMethodName(node);
899
896
  name = (0, immer_1.produce)(name, draft => {
900
897
  draft.markers = this.maybeAddOptionalMarker(draft, node);
901
898
  });
@@ -931,6 +928,13 @@ class JavaScriptParserVisitor {
931
928
  methodType: this.mapMethodType(node)
932
929
  };
933
930
  }
931
+ mapMethodName(node) {
932
+ return !node.name
933
+ ? this.mapIdentifier(node, "")
934
+ : typescript_1.default.isStringLiteral(node.name) || typescript_1.default.isNumericLiteral(node.name)
935
+ ? this.mapIdentifier(node.name, node.name.getText())
936
+ : this.visit(node.name);
937
+ }
934
938
  mapTypeInfo(node) {
935
939
  return node.type && {
936
940
  kind: _1.JS.Kind.TypeInfo,
@@ -976,7 +980,7 @@ class JavaScriptParserVisitor {
976
980
  };
977
981
  }
978
982
  visitGetAccessor(node) {
979
- const name = this.visit(node.name);
983
+ const name = this.mapMethodName(node);
980
984
  if (typescript_1.default.isComputedPropertyName(node.name)) {
981
985
  return {
982
986
  kind: _1.JS.Kind.ComputedPropertyMethodDeclaration,
@@ -1008,7 +1012,7 @@ class JavaScriptParserVisitor {
1008
1012
  };
1009
1013
  }
1010
1014
  visitSetAccessor(node) {
1011
- const name = this.visit(node.name);
1015
+ const name = this.mapMethodName(node);
1012
1016
  if (typescript_1.default.isComputedPropertyName(node.name)) {
1013
1017
  return {
1014
1018
  kind: _1.JS.Kind.ComputedPropertyMethodDeclaration,
@@ -2830,16 +2834,7 @@ class JavaScriptParserVisitor {
2830
2834
  leadingAnnotations: [],
2831
2835
  nameAnnotations: [],
2832
2836
  modifiers: this.mapModifiers(node),
2833
- name: node.name ? this.visit(node.name) : {
2834
- kind: java_1.J.Kind.Identifier,
2835
- id: (0, uuid_1.randomId)(),
2836
- prefix: java_1.emptySpace,
2837
- markers: markers_1.emptyMarkers,
2838
- annotations: [],
2839
- simpleName: "",
2840
- type: undefined,
2841
- fieldType: undefined
2842
- },
2837
+ name: this.mapMethodName(node),
2843
2838
  typeParameters: this.mapTypeParametersAsObject(node),
2844
2839
  parameters: this.mapCommaSeparatedList(this.getParameterListNodes(node)),
2845
2840
  returnTypeExpression: this.mapTypeInfo(node),