@abaplint/core 2.93.0 → 2.93.3

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.
@@ -83,10 +83,19 @@ Only one transformation is applied to a statement at a time, so multiple steps m
83
83
  const version = this.lowReg.getConfig().getVersion();
84
84
  if (version === version_1.Version.v702 || version === version_1.Version.OpenABAP) {
85
85
  this.initHighReg();
86
- this.graph = new include_graph_1.IncludeGraph(reg);
87
86
  }
88
87
  return this;
89
88
  }
89
+ listMainForInclude(filename) {
90
+ if (filename === undefined) {
91
+ return [];
92
+ }
93
+ // only initialize this.graph if needed
94
+ if (this.graph === undefined) {
95
+ this.graph = new include_graph_1.IncludeGraph(this.lowReg);
96
+ }
97
+ return this.graph.listMainForInclude(filename);
98
+ }
90
99
  run(lowObj) {
91
100
  var _a;
92
101
  const ret = [];
@@ -105,7 +114,7 @@ Only one transformation is applied to a statement at a time, so multiple steps m
105
114
  let highSyntaxObj = highObj;
106
115
  // for includes do the syntax check via a main program
107
116
  if (lowObj instanceof objects_1.Program && lowObj.isInclude()) {
108
- const mains = this.graph.listMainForInclude((_a = lowObj.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getFilename());
117
+ const mains = this.listMainForInclude((_a = lowObj.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getFilename());
109
118
  if (mains.length <= 0) {
110
119
  return [];
111
120
  }
@@ -115,8 +124,8 @@ Only one transformation is applied to a statement at a time, so multiple steps m
115
124
  }
116
125
  highSyntaxObj = this.highReg.findObjectForFile(f);
117
126
  }
118
- const highSyntax = new syntax_1.SyntaxLogic(this.highReg, highSyntaxObj).run();
119
127
  for (const lowFile of lowObj.getABAPFiles()) {
128
+ let highSyntax = undefined;
120
129
  const highFile = highObj.getABAPFileByName(lowFile.getFilename());
121
130
  if (highFile === undefined) {
122
131
  continue;
@@ -137,6 +146,9 @@ Only one transformation is applied to a statement at a time, so multiple steps m
137
146
  const high = highStatements[i];
138
147
  if ((low.get() instanceof _statement_1.Unknown && !(high.get() instanceof _statement_1.Unknown))
139
148
  || high.findFirstExpression(Expressions.InlineData)) {
149
+ if (highSyntax === undefined) {
150
+ highSyntax = new syntax_1.SyntaxLogic(this.highReg, highSyntaxObj).run();
151
+ }
140
152
  const issue = this.checkStatement(low, high, lowFile, highSyntax, highFile);
141
153
  if (issue) {
142
154
  ret.push(issue);
@@ -185,23 +197,23 @@ Only one transformation is applied to a statement at a time, so multiple steps m
185
197
  if (found) {
186
198
  return found;
187
199
  }
188
- found = this.emptyKey(high, lowFile);
200
+ found = this.emptyKey(low, high, lowFile);
189
201
  if (found) {
190
202
  return found;
191
203
  }
192
- found = this.stringTemplateAlpha(high, lowFile, highSyntax);
204
+ found = this.stringTemplateAlpha(low, high, lowFile, highSyntax);
193
205
  if (found) {
194
206
  return found;
195
207
  }
196
- found = this.moveWithOperator(high, lowFile);
208
+ found = this.moveWithOperator(low, high, lowFile);
197
209
  if (found) {
198
210
  return found;
199
211
  }
200
- found = this.moveWithSimpleValue(high, lowFile);
212
+ found = this.moveWithSimpleValue(low, high, lowFile);
201
213
  if (found) {
202
214
  return found;
203
215
  }
204
- found = this.assignWithTable(high, lowFile);
216
+ found = this.assignWithTable(low, high, lowFile);
205
217
  if (found) {
206
218
  return found;
207
219
  }
@@ -209,7 +221,7 @@ Only one transformation is applied to a statement at a time, so multiple steps m
209
221
  if (found) {
210
222
  return found;
211
223
  }
212
- found = this.downportRef(high, lowFile, highSyntax);
224
+ found = this.downportRef(low, high, lowFile, highSyntax);
213
225
  if (found) {
214
226
  return found;
215
227
  }
@@ -233,7 +245,7 @@ Only one transformation is applied to a statement at a time, so multiple steps m
233
245
  if (found) {
234
246
  return found;
235
247
  }
236
- found = this.outlineLoopInput(high, lowFile, highSyntax);
248
+ found = this.outlineLoopInput(low, high, lowFile, highSyntax);
237
249
  if (found) {
238
250
  return found;
239
251
  }
@@ -241,27 +253,27 @@ Only one transformation is applied to a statement at a time, so multiple steps m
241
253
  if (found) {
242
254
  return found;
243
255
  }
244
- found = this.outlineValue(high, lowFile, highSyntax);
256
+ found = this.outlineValue(low, high, lowFile, highSyntax);
245
257
  if (found) {
246
258
  return found;
247
259
  }
248
- found = this.outlineReduce(high, lowFile, highSyntax);
260
+ found = this.outlineReduce(low, high, lowFile, highSyntax);
249
261
  if (found) {
250
262
  return found;
251
263
  }
252
- found = this.outlineSwitch(high, lowFile, highSyntax);
264
+ found = this.outlineSwitch(low, high, lowFile, highSyntax);
253
265
  if (found) {
254
266
  return found;
255
267
  }
256
- found = this.outlineCast(high, lowFile, highSyntax);
268
+ found = this.outlineCast(low, high, lowFile, highSyntax);
257
269
  if (found) {
258
270
  return found;
259
271
  }
260
- found = this.outlineConv(high, lowFile, highSyntax);
272
+ found = this.outlineConv(low, high, lowFile, highSyntax);
261
273
  if (found) {
262
274
  return found;
263
275
  }
264
- found = this.outlineCond(high, lowFile, highSyntax);
276
+ found = this.outlineCond(low, high, lowFile, highSyntax);
265
277
  if (found) {
266
278
  return found;
267
279
  }
@@ -277,11 +289,11 @@ Only one transformation is applied to a statement at a time, so multiple steps m
277
289
  if (found) {
278
290
  return found;
279
291
  }
280
- found = this.outlineFS(high, lowFile, highSyntax);
292
+ found = this.outlineFS(low, high, lowFile, highSyntax);
281
293
  if (found) {
282
294
  return found;
283
295
  }
284
- found = this.newToCreateObject(high, lowFile, highSyntax);
296
+ found = this.newToCreateObject(low, high, lowFile, highSyntax);
285
297
  if (found) {
286
298
  return found;
287
299
  }
@@ -301,11 +313,11 @@ Only one transformation is applied to a statement at a time, so multiple steps m
301
313
  if (found) {
302
314
  return found;
303
315
  }
304
- found = this.replaceMethodConditional(high, lowFile, highSyntax);
316
+ found = this.replaceMethodConditional(low, high, lowFile, highSyntax);
305
317
  if (found) {
306
318
  return found;
307
319
  }
308
- found = this.replaceTableExpression(high, lowFile, highSyntax);
320
+ found = this.replaceTableExpression(low, high, lowFile, highSyntax);
309
321
  if (found) {
310
322
  return found;
311
323
  }
@@ -403,8 +415,11 @@ Only one transformation is applied to a statement at a time, so multiple steps m
403
415
  }
404
416
  return undefined;
405
417
  }
406
- downportSelectSingleInline(_low, high, lowFile, _highSyntax) {
418
+ downportSelectSingleInline(low, high, lowFile, _highSyntax) {
407
419
  var _a, _b, _c, _d;
420
+ if (!(low.get() instanceof _statement_1.Unknown)) {
421
+ return undefined;
422
+ }
408
423
  const targets = ((_a = high.findFirstExpression(Expressions.SQLIntoStructure)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(Expressions.SQLTarget)) || [];
409
424
  if (targets.length !== 1) {
410
425
  return undefined;
@@ -462,8 +477,11 @@ ${indentation}`);
462
477
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
463
478
  return issue_1.Issue.atToken(lowFile, inlineData.getFirstToken(), "Outline SELECT @DATA", this.getMetadata().key, this.conf.severity, fix);
464
479
  }
465
- downportSelectTableInline(_low, high, lowFile, highSyntax) {
480
+ downportSelectTableInline(low, high, lowFile, highSyntax) {
466
481
  var _a, _b, _c;
482
+ if (!(low.get() instanceof _statement_1.Unknown)) {
483
+ return undefined;
484
+ }
467
485
  const targets = ((_a = high.findFirstExpression(Expressions.SQLIntoTable)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(Expressions.SQLTarget)) || [];
468
486
  if (targets.length !== 1) {
469
487
  return undefined;
@@ -577,13 +595,16 @@ ${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
577
595
  }
578
596
  return undefined;
579
597
  }
580
- replaceTableExpression(node, lowFile, highSyntax) {
581
- for (const fieldChain of node.findAllExpressionsRecursive(Expressions.FieldChain)) {
598
+ replaceTableExpression(low, high, lowFile, highSyntax) {
599
+ if (!(low.get() instanceof _statement_1.Unknown)) {
600
+ return undefined;
601
+ }
602
+ for (const fieldChain of high.findAllExpressionsRecursive(Expressions.FieldChain)) {
582
603
  const tableExpression = fieldChain.findDirectExpression(Expressions.TableExpression);
583
604
  if (tableExpression === undefined) {
584
605
  continue;
585
606
  }
586
- const concat = node.concatTokens().toUpperCase();
607
+ const concat = high.concatTokens().toUpperCase();
587
608
  if (concat.includes(" LINE_EXISTS( ") || concat.includes(" LINE_INDEX( ")) {
588
609
  // note: line_exists() must be replaced before handling table expressions
589
610
  continue;
@@ -603,10 +624,10 @@ ${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
603
624
  continue;
604
625
  }
605
626
  const condition = this.tableCondition(tableExpression);
606
- const uniqueName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
607
- const tabixBackup = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
608
- const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
609
- const firstToken = node.getFirstToken();
627
+ const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
628
+ const tabixBackup = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
629
+ const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
630
+ const firstToken = high.getFirstToken();
610
631
  // note that the tabix restore should be done before throwing the exception
611
632
  const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${pre}.
612
633
  ${indentation}DATA ${tabixBackup} LIKE sy-tabix.
@@ -619,7 +640,7 @@ ${indentation}ENDIF.
619
640
  ${indentation}`);
620
641
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, startToken.getStart(), tableExpression.getLastToken().getEnd(), uniqueName);
621
642
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
622
- return issue_1.Issue.atToken(lowFile, node.getFirstToken(), "Outline table expression", this.getMetadata().key, this.conf.severity, fix);
643
+ return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Outline table expression", this.getMetadata().key, this.conf.severity, fix);
623
644
  }
624
645
  return undefined;
625
646
  }
@@ -801,7 +822,10 @@ ${indentation}RAISE EXCEPTION ${uniqueName2}.`;
801
822
  const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), abap);
802
823
  return issue_1.Issue.atToken(lowFile, startToken, "Downport RAISE MESSAGE", this.getMetadata().key, this.conf.severity, fix);
803
824
  }
804
- emptyKey(node, lowFile) {
825
+ emptyKey(low, node, lowFile) {
826
+ if (!(low.get() instanceof _statement_1.Unknown)) {
827
+ return undefined;
828
+ }
805
829
  for (let i of node.findAllExpressions(Expressions.TypeTable)) {
806
830
  const key = i.findDirectExpression(Expressions.TypeTableKey);
807
831
  if (key === undefined) {
@@ -950,7 +974,10 @@ LOOP AT ${groupTargetName}tab ${groupTarget}.`;
950
974
  }
951
975
  return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport, LOOP GROUP", this.getMetadata().key, this.conf.severity, fix);
952
976
  }
953
- downportRef(high, lowFile, highSyntax) {
977
+ downportRef(low, high, lowFile, highSyntax) {
978
+ if (!(low.get() instanceof _statement_1.Unknown)) {
979
+ return undefined;
980
+ }
954
981
  let found = undefined;
955
982
  for (const s of high.findAllExpressionsRecursive(Expressions.Source)) {
956
983
  if (s.getFirstToken().getStr().toUpperCase() === "REF"
@@ -968,8 +995,11 @@ LOOP AT ${groupTargetName}tab ${groupTarget}.`;
968
995
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
969
996
  return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport, REF", this.getMetadata().key, this.conf.severity, fix);
970
997
  }
971
- assignWithTable(high, lowFile) {
998
+ assignWithTable(low, high, lowFile) {
972
999
  var _a, _b;
1000
+ if (!(low.get() instanceof _statement_1.Unknown)) {
1001
+ return undefined;
1002
+ }
973
1003
  if (!(high.get() instanceof Statements.Assign)) {
974
1004
  return undefined;
975
1005
  }
@@ -1004,7 +1034,10 @@ LOOP AT ${groupTargetName}tab ${groupTarget}.`;
1004
1034
  const fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);
1005
1035
  return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport, ASSIGN table expr", this.getMetadata().key, this.conf.severity, fix);
1006
1036
  }
1007
- moveWithSimpleValue(high, lowFile) {
1037
+ moveWithSimpleValue(low, high, lowFile) {
1038
+ if (!(low.get() instanceof _statement_1.Unknown)) {
1039
+ return undefined;
1040
+ }
1008
1041
  if (!(high.get() instanceof Statements.Move)
1009
1042
  || high.getChildren().length !== 4) {
1010
1043
  return undefined;
@@ -1069,8 +1102,11 @@ CONSTANTS: BEGIN OF ${structureName},\n`;
1069
1102
  const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);
1070
1103
  return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport ENUM", this.getMetadata().key, this.conf.severity, fix);
1071
1104
  }
1072
- moveWithTableTarget(node, high, lowFile, highSyntax) {
1105
+ moveWithTableTarget(low, high, lowFile, highSyntax) {
1073
1106
  var _a;
1107
+ if (!(low.get() instanceof _statement_1.Unknown)) {
1108
+ return undefined;
1109
+ }
1074
1110
  if (!(high.get() instanceof Statements.Move)) {
1075
1111
  return undefined;
1076
1112
  }
@@ -1086,11 +1122,11 @@ CONSTANTS: BEGIN OF ${structureName},\n`;
1086
1122
  if (index === undefined) {
1087
1123
  return undefined;
1088
1124
  }
1089
- let uniqueName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
1125
+ let uniqueName = this.uniqueName(low.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
1090
1126
  uniqueName = `<${uniqueName}>`;
1091
1127
  const tName = target.concatTokens().split("[")[0];
1092
1128
  const condition = this.tableCondition(tableExpression);
1093
- const tabixBackup = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
1129
+ const tabixBackup = this.uniqueName(low.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
1094
1130
  const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
1095
1131
  // restore tabix before exeption
1096
1132
  const code = `FIELD-SYMBOLS ${uniqueName} LIKE LINE OF ${tName}.
@@ -1110,9 +1146,12 @@ ${indentation}${uniqueName}`;
1110
1146
  const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);
1111
1147
  return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport, move with table target", this.getMetadata().key, this.conf.severity, fix);
1112
1148
  }
1113
- moveWithOperator(high, lowFile) {
1149
+ moveWithOperator(low, high, lowFile) {
1114
1150
  var _a, _b, _c;
1115
- if (!(high.get() instanceof Statements.Move)) {
1151
+ if (!(low.get() instanceof _statement_1.Unknown)) {
1152
+ return undefined;
1153
+ }
1154
+ else if (!(high.get() instanceof Statements.Move)) {
1116
1155
  return undefined;
1117
1156
  }
1118
1157
  const children = high.getChildren();
@@ -1153,12 +1192,15 @@ ${indentation}${uniqueName}`;
1153
1192
  return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Expand operator", this.getMetadata().key, this.conf.severity, fix);
1154
1193
  }
1155
1194
  // must be very simple string templates, like "|{ ls_line-no ALPHA = IN }|"
1156
- stringTemplateAlpha(node, lowFile, highSyntax) {
1195
+ stringTemplateAlpha(low, high, lowFile, highSyntax) {
1157
1196
  var _a, _b, _c;
1158
- if (!(node.get() instanceof Statements.Move)) {
1197
+ if (!(low.get() instanceof _statement_1.Unknown)) {
1198
+ return undefined;
1199
+ }
1200
+ else if (!(high.get() instanceof Statements.Move)) {
1159
1201
  return undefined;
1160
1202
  }
1161
- const topSource = node.findDirectExpression(Expressions.Source);
1203
+ const topSource = high.findDirectExpression(Expressions.Source);
1162
1204
  if (topSource === undefined || topSource.getChildren().length !== 1) {
1163
1205
  return undefined;
1164
1206
  }
@@ -1190,10 +1232,10 @@ ${indentation}${uniqueName}`;
1190
1232
  default:
1191
1233
  return undefined;
1192
1234
  }
1193
- const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
1235
+ const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
1194
1236
  const source = (_b = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();
1195
- const topTarget = (_c = node.findDirectExpression(Expressions.Target)) === null || _c === void 0 ? void 0 : _c.concatTokens();
1196
- const uniqueName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
1237
+ const topTarget = (_c = high.findDirectExpression(Expressions.Target)) === null || _c === void 0 ? void 0 : _c.concatTokens();
1238
+ const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
1197
1239
  if (top === false) {
1198
1240
  const code = `DATA ${uniqueName} TYPE string.
1199
1241
  ${indentation}CALL FUNCTION '${functionName}'
@@ -1201,10 +1243,10 @@ ${indentation} EXPORTING
1201
1243
  ${indentation} input = ${source}
1202
1244
  ${indentation} IMPORTING
1203
1245
  ${indentation} output = ${uniqueName}.\n`;
1204
- const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);
1246
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);
1205
1247
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, child.getFirstToken().getStart(), child.getLastToken().getEnd(), uniqueName);
1206
1248
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
1207
- return issue_1.Issue.atToken(lowFile, node.getFirstToken(), "Downport ALPHA", this.getMetadata().key, this.conf.severity, fix);
1249
+ return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport ALPHA", this.getMetadata().key, this.conf.severity, fix);
1208
1250
  }
1209
1251
  else {
1210
1252
  const code = `CALL FUNCTION '${functionName}'
@@ -1212,29 +1254,32 @@ ${indentation} EXPORTING
1212
1254
  ${indentation} input = ${source}
1213
1255
  ${indentation} IMPORTING
1214
1256
  ${indentation} output = ${topTarget}.`;
1215
- const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getFirstToken().getStart(), node.getLastToken().getEnd(), code);
1216
- return issue_1.Issue.atToken(lowFile, node.getFirstToken(), "Downport ALPHA", this.getMetadata().key, this.conf.severity, fix);
1257
+ const fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);
1258
+ return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport ALPHA", this.getMetadata().key, this.conf.severity, fix);
1217
1259
  }
1218
1260
  }
1219
- outlineLoopInput(node, lowFile, highSyntax) {
1220
- if (!(node.get() instanceof Statements.Loop)) {
1261
+ outlineLoopInput(low, high, lowFile, highSyntax) {
1262
+ if (!(low.get() instanceof _statement_1.Unknown)) {
1263
+ return undefined;
1264
+ }
1265
+ else if (!(high.get() instanceof Statements.Loop)) {
1221
1266
  return undefined;
1222
1267
  }
1223
- else if (node.findDirectExpression(Expressions.SimpleSource2)) {
1268
+ else if (high.findDirectExpression(Expressions.SimpleSource2)) {
1224
1269
  return undefined;
1225
1270
  }
1226
1271
  // the first Source must be outlined
1227
- const s = node.findDirectExpression(Expressions.Source);
1272
+ const s = high.findDirectExpression(Expressions.Source);
1228
1273
  if (s === undefined) {
1229
1274
  return undefined;
1230
1275
  }
1231
- const uniqueName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
1276
+ const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
1232
1277
  const code = `DATA(${uniqueName}) = ${s.concatTokens()}.\n` +
1233
- " ".repeat(node.getFirstToken().getStart().getCol() - 1);
1234
- const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);
1278
+ " ".repeat(high.getFirstToken().getStart().getCol() - 1);
1279
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);
1235
1280
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, s.getFirstToken().getStart(), s.getLastToken().getEnd(), uniqueName);
1236
1281
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
1237
- return issue_1.Issue.atToken(lowFile, node.getFirstToken(), "Outline LOOP input", this.getMetadata().key, this.conf.severity, fix);
1282
+ return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Outline LOOP input", this.getMetadata().key, this.conf.severity, fix);
1238
1283
  }
1239
1284
  outlineLoopTarget(node, lowFile, _highSyntax) {
1240
1285
  var _a, _b, _c, _d, _e, _f, _g;
@@ -1323,19 +1368,22 @@ ${indentation} output = ${topTarget}.`;
1323
1368
  }
1324
1369
  return { body, end };
1325
1370
  }
1326
- outlineSwitch(node, lowFile, highSyntax) {
1371
+ outlineSwitch(low, high, lowFile, highSyntax) {
1327
1372
  var _a, _b, _c, _d;
1328
- for (const i of node.findAllExpressionsRecursive(Expressions.Source)) {
1373
+ if (!(low.get() instanceof _statement_1.Unknown)) {
1374
+ return undefined;
1375
+ }
1376
+ for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {
1329
1377
  const firstToken = i.getFirstToken();
1330
1378
  if (firstToken.getStr().toUpperCase() !== "SWITCH") {
1331
1379
  continue;
1332
1380
  }
1333
1381
  let type = this.findType(i, lowFile, highSyntax);
1334
1382
  if (type === undefined) {
1335
- if (node.get() instanceof Statements.Move
1336
- && node.findDirectExpression(Expressions.Source) === i
1337
- && ((_a = node.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.TargetField)) !== undefined) {
1338
- type = "LIKE " + ((_b = node.findDirectExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens());
1383
+ if (high.get() instanceof Statements.Move
1384
+ && high.findDirectExpression(Expressions.Source) === i
1385
+ && ((_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.TargetField)) !== undefined) {
1386
+ type = "LIKE " + ((_b = high.findDirectExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens());
1339
1387
  }
1340
1388
  if (type === undefined) {
1341
1389
  continue;
@@ -1345,7 +1393,7 @@ ${indentation} output = ${topTarget}.`;
1345
1393
  type = "TYPE " + type;
1346
1394
  }
1347
1395
  const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
1348
- const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
1396
+ const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
1349
1397
  let body = "";
1350
1398
  let name = "";
1351
1399
  const switchBody = i.findDirectExpression(Expressions.SwitchBody);
@@ -1387,16 +1435,19 @@ ${indentation} output = ${topTarget}.`;
1387
1435
  }
1388
1436
  }
1389
1437
  body += "\n" + indentation + "ENDCASE.\n" + indentation;
1390
- const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), body);
1438
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), body);
1391
1439
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), i.getLastToken().getEnd(), uniqueName);
1392
1440
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
1393
1441
  return issue_1.Issue.atToken(lowFile, firstToken, "Downport SWITCH", this.getMetadata().key, this.conf.severity, fix);
1394
1442
  }
1395
1443
  return undefined;
1396
1444
  }
1397
- outlineReduce(node, lowFile, highSyntax) {
1445
+ outlineReduce(low, high, lowFile, highSyntax) {
1398
1446
  var _a, _b;
1399
- for (const i of node.findAllExpressionsRecursive(Expressions.Source)) {
1447
+ if (!(low.get() instanceof _statement_1.Unknown)) {
1448
+ return undefined;
1449
+ }
1450
+ for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {
1400
1451
  const firstToken = i.getFirstToken();
1401
1452
  if (firstToken.getStr().toUpperCase() !== "REDUCE") {
1402
1453
  continue;
@@ -1406,7 +1457,7 @@ ${indentation} output = ${topTarget}.`;
1406
1457
  continue;
1407
1458
  }
1408
1459
  const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
1409
- const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
1460
+ const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
1410
1461
  let body = "";
1411
1462
  let name = "";
1412
1463
  const reduceBody = i.findDirectExpression(Expressions.ReduceBody);
@@ -1462,16 +1513,19 @@ ${indentation} output = ${topTarget}.`;
1462
1513
  const abap = `DATA ${uniqueName} TYPE ${type}.\n` +
1463
1514
  body +
1464
1515
  indentation;
1465
- const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), abap);
1516
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);
1466
1517
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), i.getLastToken().getEnd(), uniqueName);
1467
1518
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
1468
1519
  return issue_1.Issue.atToken(lowFile, firstToken, "Downport REDUCE", this.getMetadata().key, this.conf.severity, fix);
1469
1520
  }
1470
1521
  return undefined;
1471
1522
  }
1472
- outlineValue(node, lowFile, highSyntax) {
1523
+ outlineValue(low, high, lowFile, highSyntax) {
1473
1524
  var _a, _b, _c;
1474
- const allSources = node.findAllExpressionsRecursive(Expressions.Source);
1525
+ if (!(low.get() instanceof _statement_1.Unknown)) {
1526
+ return undefined;
1527
+ }
1528
+ const allSources = high.findAllExpressionsRecursive(Expressions.Source);
1475
1529
  for (const s of allSources) {
1476
1530
  const firstToken = s.getFirstToken();
1477
1531
  if (firstToken.getStr().toUpperCase() !== "VALUE") {
@@ -1479,8 +1533,8 @@ ${indentation} output = ${topTarget}.`;
1479
1533
  }
1480
1534
  let type = this.findType(s, lowFile, highSyntax);
1481
1535
  if (type === undefined) {
1482
- if (node.get() instanceof Statements.Move && node.findDirectExpression(Expressions.Source) === s) {
1483
- type = "LIKE " + ((_a = node.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.concatTokens());
1536
+ if (high.get() instanceof Statements.Move && high.findDirectExpression(Expressions.Source) === s) {
1537
+ type = "LIKE " + ((_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.concatTokens());
1484
1538
  }
1485
1539
  if (type === undefined) {
1486
1540
  continue;
@@ -1491,7 +1545,7 @@ ${indentation} output = ${topTarget}.`;
1491
1545
  }
1492
1546
  const valueBody = s.findDirectExpression(Expressions.ValueBody);
1493
1547
  const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
1494
- let indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
1548
+ let indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
1495
1549
  let body = "";
1496
1550
  const base = valueBody === null || valueBody === void 0 ? void 0 : valueBody.findExpressionAfterToken("BASE");
1497
1551
  if (base) {
@@ -1598,7 +1652,7 @@ ${indentation} output = ${topTarget}.`;
1598
1652
  indentation + `CLEAR ${uniqueName}.\n` + // might be called inside a loop
1599
1653
  body +
1600
1654
  indentation;
1601
- const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), abap);
1655
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);
1602
1656
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), s.getLastToken().getEnd(), uniqueName);
1603
1657
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
1604
1658
  return issue_1.Issue.atToken(lowFile, firstToken, "Downport VALUE", this.getMetadata().key, this.conf.severity, fix);
@@ -1670,17 +1724,20 @@ ${indentation} output = ${topTarget}.`;
1670
1724
  return (_a = inferred.getType().getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toLowerCase();
1671
1725
  }
1672
1726
  }
1673
- outlineFS(node, lowFile, highSyntax) {
1727
+ outlineFS(low, high, lowFile, highSyntax) {
1674
1728
  var _a, _b;
1675
- for (const i of node.findAllExpressionsRecursive(Expressions.InlineFS)) {
1729
+ if (!(low.get() instanceof _statement_1.Unknown)) {
1730
+ return undefined;
1731
+ }
1732
+ for (const i of high.findAllExpressionsRecursive(Expressions.InlineFS)) {
1676
1733
  const nameToken = (_a = i.findDirectExpression(Expressions.TargetFieldSymbol)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
1677
1734
  if (nameToken === undefined) {
1678
1735
  continue;
1679
1736
  }
1680
1737
  const name = nameToken.getStr();
1681
1738
  let type = "";
1682
- if (node.concatTokens().toUpperCase().startsWith("APPEND INITIAL LINE TO ")) {
1683
- type = "LIKE LINE OF " + ((_b = node.findFirstExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens());
1739
+ if (high.concatTokens().toUpperCase().startsWith("APPEND INITIAL LINE TO ")) {
1740
+ type = "LIKE LINE OF " + ((_b = high.findFirstExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens());
1684
1741
  }
1685
1742
  else {
1686
1743
  const spag = highSyntax.spaghetti.lookupPosition(nameToken.getStart(), lowFile.getFilename());
@@ -1698,8 +1755,8 @@ ${indentation} output = ${topTarget}.`;
1698
1755
  type += found.getType().getQualifiedName() ? found.getType().getQualifiedName().toLowerCase() : found.getType().toABAP();
1699
1756
  }
1700
1757
  const code = `FIELD-SYMBOLS ${name} ${type}.\n` +
1701
- " ".repeat(node.getFirstToken().getStart().getCol() - 1);
1702
- const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);
1758
+ " ".repeat(high.getFirstToken().getStart().getCol() - 1);
1759
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);
1703
1760
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), name);
1704
1761
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
1705
1762
  return issue_1.Issue.atToken(lowFile, i.getFirstToken(), "Outline FIELD-SYMBOL", this.getMetadata().key, this.conf.severity, fix);
@@ -1707,6 +1764,7 @@ ${indentation} output = ${topTarget}.`;
1707
1764
  return undefined;
1708
1765
  }
1709
1766
  outlineData(node, lowFile, highSyntax) {
1767
+ // hmm, no guard here, as DATA(SDF) is valid in 702
1710
1768
  var _a, _b;
1711
1769
  for (const i of node.findAllExpressionsRecursive(Expressions.InlineData)) {
1712
1770
  const nameToken = (_a = i.findDirectExpression(Expressions.TargetField)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
@@ -1738,9 +1796,12 @@ ${indentation} output = ${topTarget}.`;
1738
1796
  }
1739
1797
  return undefined;
1740
1798
  }
1741
- outlineCond(node, lowFile, highSyntax) {
1799
+ outlineCond(low, high, lowFile, highSyntax) {
1742
1800
  var _a, _b;
1743
- for (const i of node.findAllExpressionsRecursive(Expressions.Source)) {
1801
+ if (!(low.get() instanceof _statement_1.Unknown)) {
1802
+ return undefined;
1803
+ }
1804
+ for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {
1744
1805
  if (i.getFirstToken().getStr().toUpperCase() !== "COND") {
1745
1806
  continue;
1746
1807
  }
@@ -1751,10 +1812,10 @@ ${indentation} output = ${topTarget}.`;
1751
1812
  const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
1752
1813
  let type = this.findType(i, lowFile, highSyntax);
1753
1814
  if (type === undefined) {
1754
- if (node.get() instanceof Statements.Move
1755
- && node.findDirectExpression(Expressions.Source) === i
1756
- && ((_a = node.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.TargetField)) !== undefined) {
1757
- type = "LIKE " + ((_b = node.findDirectExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens());
1815
+ if (high.get() instanceof Statements.Move
1816
+ && high.findDirectExpression(Expressions.Source) === i
1817
+ && ((_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.TargetField)) !== undefined) {
1818
+ type = "LIKE " + ((_b = high.findDirectExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens());
1758
1819
  }
1759
1820
  if (type === undefined) {
1760
1821
  continue;
@@ -1763,10 +1824,10 @@ ${indentation} output = ${topTarget}.`;
1763
1824
  else {
1764
1825
  type = "TYPE " + type;
1765
1826
  }
1766
- const indent = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
1827
+ const indent = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
1767
1828
  const bodyCode = this.buildCondBody(body, uniqueName, indent, lowFile, highSyntax);
1768
1829
  const abap = `DATA ${uniqueName} ${type}.\n` + bodyCode;
1769
- const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), abap);
1830
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);
1770
1831
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), uniqueName);
1771
1832
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
1772
1833
  return issue_1.Issue.atToken(lowFile, i.getFirstToken(), "Downport COND", this.getMetadata().key, this.conf.severity, fix);
@@ -1822,9 +1883,12 @@ ${indentation} output = ${topTarget}.`;
1822
1883
  code += indent;
1823
1884
  return code;
1824
1885
  }
1825
- outlineConv(node, lowFile, highSyntax) {
1886
+ outlineConv(low, high, lowFile, highSyntax) {
1826
1887
  var _a;
1827
- for (const i of node.findAllExpressionsRecursive(Expressions.Source)) {
1888
+ if (!(low.get() instanceof _statement_1.Unknown)) {
1889
+ return undefined;
1890
+ }
1891
+ for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {
1828
1892
  if (i.getFirstToken().getStr().toUpperCase() !== "CONV") {
1829
1893
  continue;
1830
1894
  }
@@ -1838,11 +1902,11 @@ ${indentation} output = ${topTarget}.`;
1838
1902
  }
1839
1903
  const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
1840
1904
  const type = this.findType(i, lowFile, highSyntax);
1841
- const indent = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
1905
+ const indent = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
1842
1906
  const abap = `DATA ${uniqueName} TYPE ${type}.\n` +
1843
1907
  indent + `${uniqueName} = ${body}.\n` +
1844
1908
  indent;
1845
- const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), abap);
1909
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);
1846
1910
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), end.getEnd(), uniqueName);
1847
1911
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
1848
1912
  return issue_1.Issue.atToken(lowFile, i.getFirstToken(), "Downport CONV", this.getMetadata().key, this.conf.severity, fix);
@@ -1850,17 +1914,20 @@ ${indentation} output = ${topTarget}.`;
1850
1914
  return undefined;
1851
1915
  }
1852
1916
  // "CAST" to "?="
1853
- outlineCast(node, lowFile, highSyntax) {
1917
+ outlineCast(low, high, lowFile, highSyntax) {
1854
1918
  var _a;
1855
- for (const i of node.findAllExpressionsRecursive(Expressions.Cast)) {
1919
+ if (!(low.get() instanceof _statement_1.Unknown)) {
1920
+ return undefined;
1921
+ }
1922
+ for (const i of high.findAllExpressionsRecursive(Expressions.Cast)) {
1856
1923
  const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
1857
1924
  const type = this.findType(i, lowFile, highSyntax, true);
1858
1925
  const body = (_a = i.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();
1859
1926
  const abap = `DATA ${uniqueName} TYPE ${type}.\n` +
1860
- " ".repeat(node.getFirstToken().getStart().getCol() - 1) +
1927
+ " ".repeat(high.getFirstToken().getStart().getCol() - 1) +
1861
1928
  `${uniqueName} ?= ${body}.\n` +
1862
- " ".repeat(node.getFirstToken().getStart().getCol() - 1);
1863
- const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), abap);
1929
+ " ".repeat(high.getFirstToken().getStart().getCol() - 1);
1930
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);
1864
1931
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), uniqueName);
1865
1932
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
1866
1933
  return issue_1.Issue.atToken(lowFile, i.getFirstToken(), "Downport CAST", this.getMetadata().key, this.conf.severity, fix);
@@ -1904,14 +1971,17 @@ ${indentation} output = ${topTarget}.`;
1904
1971
  }
1905
1972
  return undefined;
1906
1973
  }
1907
- replaceMethodConditional(node, lowFile, highSyntax) {
1908
- for (const c of node.findAllExpressionsRecursive(Expressions.Compare)) {
1974
+ replaceMethodConditional(low, high, lowFile, highSyntax) {
1975
+ if (!(low.get() instanceof _statement_1.Unknown)) {
1976
+ return undefined;
1977
+ }
1978
+ for (const c of high.findAllExpressionsRecursive(Expressions.Compare)) {
1909
1979
  const chain = c.findDirectExpression(Expressions.MethodCallChain);
1910
1980
  if (chain === undefined) {
1911
1981
  continue;
1912
1982
  }
1913
1983
  let predicate = false;
1914
- const spag = highSyntax.spaghetti.lookupPosition(node.getFirstToken().getStart(), lowFile.getFilename());
1984
+ const spag = highSyntax.spaghetti.lookupPosition(high.getFirstToken().getStart(), lowFile.getFilename());
1915
1985
  for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {
1916
1986
  if (r.referenceType === _reference_1.ReferenceType.BuiltinMethodReference &&
1917
1987
  new _builtin_1.BuiltIn().isPredicate(chain.getFirstToken().getStr().toUpperCase())) {
@@ -2032,13 +2102,16 @@ ${indentation} output = ${topTarget}.`;
2032
2102
  }
2033
2103
  return undefined;
2034
2104
  }
2035
- newToCreateObject(node, lowFile, highSyntax) {
2036
- const source = node.findDirectExpression(Expressions.Source);
2105
+ newToCreateObject(low, high, lowFile, highSyntax) {
2106
+ if (!(low.get() instanceof _statement_1.Unknown)) {
2107
+ return undefined;
2108
+ }
2109
+ const source = high.findDirectExpression(Expressions.Source);
2037
2110
  let fix = undefined;
2038
- if (node.get() instanceof Statements.Move
2111
+ if (high.get() instanceof Statements.Move
2039
2112
  && source
2040
2113
  && source.getFirstToken().getStr().toUpperCase() === "NEW") {
2041
- const target = node.findDirectExpression(Expressions.Target);
2114
+ const target = high.findDirectExpression(Expressions.Target);
2042
2115
  const found = source === null || source === void 0 ? void 0 : source.findFirstExpression(Expressions.NewObject);
2043
2116
  // must be at top level of the source for quickfix to work(todo: handle more scenarios)
2044
2117
  if (target
@@ -2047,12 +2120,12 @@ ${indentation} output = ${topTarget}.`;
2047
2120
  && target.findDirectExpression(Expressions.InlineData) === undefined) {
2048
2121
  const abap = this.newParameters(found, target.concatTokens(), highSyntax, lowFile);
2049
2122
  if (abap !== undefined) {
2050
- fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getFirstToken().getStart(), node.getLastToken().getEnd(), abap);
2123
+ fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), abap);
2051
2124
  }
2052
2125
  }
2053
2126
  }
2054
- if (fix === undefined && node.findAllExpressions(Expressions.NewObject)) {
2055
- const found = node.findFirstExpression(Expressions.NewObject);
2127
+ if (fix === undefined && high.findAllExpressions(Expressions.NewObject)) {
2128
+ const found = high.findFirstExpression(Expressions.NewObject);
2056
2129
  if (found === undefined) {
2057
2130
  return undefined;
2058
2131
  }
@@ -2062,16 +2135,16 @@ ${indentation} output = ${topTarget}.`;
2062
2135
  return undefined;
2063
2136
  }
2064
2137
  const type = this.findType(found, lowFile, highSyntax);
2065
- const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
2138
+ const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
2066
2139
  const data = `DATA ${name} TYPE REF TO ${type}.\n` +
2067
2140
  indentation + abap + "\n" +
2068
2141
  indentation;
2069
- const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), data);
2142
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), data);
2070
2143
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, found.getFirstToken().getStart(), found.getLastToken().getEnd(), name);
2071
2144
  fix = edit_helper_1.EditHelper.merge(fix2, fix1);
2072
2145
  }
2073
2146
  if (fix) {
2074
- return issue_1.Issue.atToken(lowFile, node.getFirstToken(), "Use CREATE OBJECT instead of NEW", this.getMetadata().key, this.conf.severity, fix);
2147
+ return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Use CREATE OBJECT instead of NEW", this.getMetadata().key, this.conf.severity, fix);
2075
2148
  }
2076
2149
  else {
2077
2150
  return undefined;