@abaplint/core 2.93.1 → 2.93.2

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.
@@ -5516,6 +5516,7 @@ declare class StructureNode extends AbstractNode<StructureNode | StatementNode>
5516
5516
  findAllStatements(type: new () => IStatement): StatementNode[];
5517
5517
  findAllStatementNodes(): StatementNode[];
5518
5518
  findAllStructuresRecursive(type: new () => IStructure): StructureNode[];
5519
+ findAllStructuresMulti(type: (new () => IStructure)[]): StructureNode[];
5519
5520
  findAllStructures(type: new () => IStructure): StructureNode[];
5520
5521
  findDirectStructure(type: new () => IStructure): StructureNode | undefined;
5521
5522
  findFirstStructure(type: new () => IStructure): StructureNode | undefined;
@@ -174,6 +174,30 @@ class StructureNode extends _abstract_node_1.AbstractNode {
174
174
  }
175
175
  return ret;
176
176
  }
177
+ findAllStructuresMulti(type) {
178
+ const ret = [];
179
+ for (const t of type) {
180
+ if (this.get() instanceof t) {
181
+ return [this];
182
+ }
183
+ }
184
+ for (const child of this.getChildren()) {
185
+ if (child instanceof statement_node_1.StatementNode) {
186
+ continue;
187
+ }
188
+ let found = false;
189
+ for (const t of type) {
190
+ if (this.get() instanceof t) {
191
+ ret.push(child);
192
+ found = true;
193
+ }
194
+ }
195
+ if (found === false) {
196
+ ret.push(...child.findAllStructuresMulti(type));
197
+ }
198
+ }
199
+ return ret;
200
+ }
177
201
  findAllStructures(type) {
178
202
  const ret = [];
179
203
  if (this.get() instanceof type) {
@@ -67,7 +67,7 @@ class Registry {
67
67
  }
68
68
  static abaplintVersion() {
69
69
  // magic, see build script "version.sh"
70
- return "2.93.1";
70
+ return "2.93.2";
71
71
  }
72
72
  getDDICReferences() {
73
73
  return this.references;
@@ -24,11 +24,11 @@ class BeginEndNames extends _abap_rule_1.ABAPRule {
24
24
  shortDescription: `Check BEGIN OF and END OF names match, plus there must be statements between BEGIN and END`,
25
25
  tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
26
26
  badExample: `DATA: BEGIN OF stru,
27
- field TYPE i,
28
- END OF structure_not_the_same.`,
27
+ field TYPE i,
28
+ END OF structure_not_the_same.`,
29
29
  goodExample: `DATA: BEGIN OF stru,
30
- field TYPE i,
31
- END OF stru.`,
30
+ field TYPE i,
31
+ END OF stru.`,
32
32
  };
33
33
  }
34
34
  getConfig() {
@@ -56,16 +56,15 @@ https://docs.abapopenchecks.org/checks/17/`,
56
56
  if (containsUnknown === true) {
57
57
  return [];
58
58
  }
59
- const routines = structure.findAllStructures(Structures.Form).concat(structure.findAllStructures(Structures.Method));
59
+ const routines = structure.findAllStructuresMulti([Structures.Form, Structures.Method]);
60
60
  for (const r of routines) {
61
61
  // one fix per routine
62
62
  this.fixed = false;
63
63
  this.mode = DEFINITION;
64
64
  this.moveTo = (_a = r.getFirstStatement()) === null || _a === void 0 ? void 0 : _a.getLastToken().getEnd();
65
- if (this.reg.getConfig().getVersion() !== version_1.Version.v702) {
66
- if (r.findFirstExpression(Expressions.InlineData)) {
67
- continue;
68
- }
65
+ if (this.reg.getConfig().getVersion() !== version_1.Version.v702
66
+ && r.findFirstExpression(Expressions.InlineData)) {
67
+ continue;
69
68
  }
70
69
  const found = this.walk(r, file);
71
70
  if (found) {
@@ -79,20 +78,23 @@ https://docs.abapopenchecks.org/checks/17/`,
79
78
  var _a, _b, _c, _d, _e, _f;
80
79
  let previous = undefined;
81
80
  for (const c of r.getChildren()) {
82
- if (c instanceof nodes_1.StatementNode && c.get() instanceof _statement_1.Comment) {
83
- continue;
84
- }
85
- else if (c instanceof nodes_1.StatementNode && c.get() instanceof Statements.Form) {
86
- continue;
87
- }
88
- else if (c instanceof nodes_1.StatementNode && c.get() instanceof Statements.MethodImplementation) {
89
- continue;
81
+ const get = c.get();
82
+ if (c instanceof nodes_1.StatementNode) {
83
+ if (get instanceof _statement_1.Comment) {
84
+ continue;
85
+ }
86
+ else if (get instanceof Statements.Form) {
87
+ continue;
88
+ }
89
+ else if (get instanceof Statements.MethodImplementation) {
90
+ continue;
91
+ }
90
92
  }
91
93
  if (c instanceof nodes_1.StructureNode
92
- && (c.get() instanceof Structures.Data
93
- || c.get() instanceof Structures.Types
94
- || c.get() instanceof Structures.Constants
95
- || c.get() instanceof Structures.Statics)) {
94
+ && (get instanceof Structures.Data
95
+ || get instanceof Structures.Types
96
+ || get instanceof Structures.Constants
97
+ || get instanceof Structures.Statics)) {
96
98
  if (this.mode === AFTER) {
97
99
  // These are chained structured statements
98
100
  let fix = undefined;
@@ -118,11 +120,11 @@ https://docs.abapopenchecks.org/checks/17/`,
118
120
  }
119
121
  }
120
122
  else if (c instanceof nodes_1.StatementNode
121
- && (c.get() instanceof Statements.Data
122
- || c.get() instanceof Statements.Type
123
- || c.get() instanceof Statements.Constant
124
- || c.get() instanceof Statements.Static
125
- || c.get() instanceof Statements.FieldSymbol)) {
123
+ && (get instanceof Statements.Data
124
+ || get instanceof Statements.Type
125
+ || get instanceof Statements.Constant
126
+ || get instanceof Statements.Static
127
+ || get instanceof Statements.FieldSymbol)) {
126
128
  if (this.mode === AFTER) {
127
129
  // only one fix per routine, as it reorders a lot
128
130
  let fix = undefined;
@@ -136,11 +138,11 @@ https://docs.abapopenchecks.org/checks/17/`,
136
138
  this.moveTo = c.getLastToken().getEnd();
137
139
  }
138
140
  }
139
- else if (c instanceof nodes_1.StructureNode && c.get() instanceof Structures.Define) {
141
+ else if (c instanceof nodes_1.StructureNode && get instanceof Structures.Define) {
140
142
  this.mode = IGNORE;
141
143
  return undefined;
142
144
  }
143
- else if (c instanceof nodes_1.StatementNode && c.get() instanceof _statement_1.Unknown) {
145
+ else if (c instanceof nodes_1.StatementNode && get instanceof _statement_1.Unknown) {
144
146
  this.mode = IGNORE;
145
147
  return undefined;
146
148
  }
@@ -197,23 +197,23 @@ Only one transformation is applied to a statement at a time, so multiple steps m
197
197
  if (found) {
198
198
  return found;
199
199
  }
200
- found = this.emptyKey(high, lowFile);
200
+ found = this.emptyKey(low, high, lowFile);
201
201
  if (found) {
202
202
  return found;
203
203
  }
204
- found = this.stringTemplateAlpha(high, lowFile, highSyntax);
204
+ found = this.stringTemplateAlpha(low, high, lowFile, highSyntax);
205
205
  if (found) {
206
206
  return found;
207
207
  }
208
- found = this.moveWithOperator(high, lowFile);
208
+ found = this.moveWithOperator(low, high, lowFile);
209
209
  if (found) {
210
210
  return found;
211
211
  }
212
- found = this.moveWithSimpleValue(high, lowFile);
212
+ found = this.moveWithSimpleValue(low, high, lowFile);
213
213
  if (found) {
214
214
  return found;
215
215
  }
216
- found = this.assignWithTable(high, lowFile);
216
+ found = this.assignWithTable(low, high, lowFile);
217
217
  if (found) {
218
218
  return found;
219
219
  }
@@ -221,7 +221,7 @@ Only one transformation is applied to a statement at a time, so multiple steps m
221
221
  if (found) {
222
222
  return found;
223
223
  }
224
- found = this.downportRef(high, lowFile, highSyntax);
224
+ found = this.downportRef(low, high, lowFile, highSyntax);
225
225
  if (found) {
226
226
  return found;
227
227
  }
@@ -245,7 +245,7 @@ Only one transformation is applied to a statement at a time, so multiple steps m
245
245
  if (found) {
246
246
  return found;
247
247
  }
248
- found = this.outlineLoopInput(high, lowFile, highSyntax);
248
+ found = this.outlineLoopInput(low, high, lowFile, highSyntax);
249
249
  if (found) {
250
250
  return found;
251
251
  }
@@ -253,27 +253,27 @@ Only one transformation is applied to a statement at a time, so multiple steps m
253
253
  if (found) {
254
254
  return found;
255
255
  }
256
- found = this.outlineValue(high, lowFile, highSyntax);
256
+ found = this.outlineValue(low, high, lowFile, highSyntax);
257
257
  if (found) {
258
258
  return found;
259
259
  }
260
- found = this.outlineReduce(high, lowFile, highSyntax);
260
+ found = this.outlineReduce(low, high, lowFile, highSyntax);
261
261
  if (found) {
262
262
  return found;
263
263
  }
264
- found = this.outlineSwitch(high, lowFile, highSyntax);
264
+ found = this.outlineSwitch(low, high, lowFile, highSyntax);
265
265
  if (found) {
266
266
  return found;
267
267
  }
268
- found = this.outlineCast(high, lowFile, highSyntax);
268
+ found = this.outlineCast(low, high, lowFile, highSyntax);
269
269
  if (found) {
270
270
  return found;
271
271
  }
272
- found = this.outlineConv(high, lowFile, highSyntax);
272
+ found = this.outlineConv(low, high, lowFile, highSyntax);
273
273
  if (found) {
274
274
  return found;
275
275
  }
276
- found = this.outlineCond(high, lowFile, highSyntax);
276
+ found = this.outlineCond(low, high, lowFile, highSyntax);
277
277
  if (found) {
278
278
  return found;
279
279
  }
@@ -289,11 +289,11 @@ Only one transformation is applied to a statement at a time, so multiple steps m
289
289
  if (found) {
290
290
  return found;
291
291
  }
292
- found = this.outlineFS(high, lowFile, highSyntax);
292
+ found = this.outlineFS(low, high, lowFile, highSyntax);
293
293
  if (found) {
294
294
  return found;
295
295
  }
296
- found = this.newToCreateObject(high, lowFile, highSyntax);
296
+ found = this.newToCreateObject(low, high, lowFile, highSyntax);
297
297
  if (found) {
298
298
  return found;
299
299
  }
@@ -313,11 +313,11 @@ Only one transformation is applied to a statement at a time, so multiple steps m
313
313
  if (found) {
314
314
  return found;
315
315
  }
316
- found = this.replaceMethodConditional(high, lowFile, highSyntax);
316
+ found = this.replaceMethodConditional(low, high, lowFile, highSyntax);
317
317
  if (found) {
318
318
  return found;
319
319
  }
320
- found = this.replaceTableExpression(high, lowFile, highSyntax);
320
+ found = this.replaceTableExpression(low, high, lowFile, highSyntax);
321
321
  if (found) {
322
322
  return found;
323
323
  }
@@ -415,8 +415,11 @@ Only one transformation is applied to a statement at a time, so multiple steps m
415
415
  }
416
416
  return undefined;
417
417
  }
418
- downportSelectSingleInline(_low, high, lowFile, _highSyntax) {
418
+ downportSelectSingleInline(low, high, lowFile, _highSyntax) {
419
419
  var _a, _b, _c, _d;
420
+ if (!(low.get() instanceof _statement_1.Unknown)) {
421
+ return undefined;
422
+ }
420
423
  const targets = ((_a = high.findFirstExpression(Expressions.SQLIntoStructure)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(Expressions.SQLTarget)) || [];
421
424
  if (targets.length !== 1) {
422
425
  return undefined;
@@ -474,8 +477,11 @@ ${indentation}`);
474
477
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
475
478
  return issue_1.Issue.atToken(lowFile, inlineData.getFirstToken(), "Outline SELECT @DATA", this.getMetadata().key, this.conf.severity, fix);
476
479
  }
477
- downportSelectTableInline(_low, high, lowFile, highSyntax) {
480
+ downportSelectTableInline(low, high, lowFile, highSyntax) {
478
481
  var _a, _b, _c;
482
+ if (!(low.get() instanceof _statement_1.Unknown)) {
483
+ return undefined;
484
+ }
479
485
  const targets = ((_a = high.findFirstExpression(Expressions.SQLIntoTable)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(Expressions.SQLTarget)) || [];
480
486
  if (targets.length !== 1) {
481
487
  return undefined;
@@ -589,13 +595,16 @@ ${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
589
595
  }
590
596
  return undefined;
591
597
  }
592
- replaceTableExpression(node, lowFile, highSyntax) {
593
- 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)) {
594
603
  const tableExpression = fieldChain.findDirectExpression(Expressions.TableExpression);
595
604
  if (tableExpression === undefined) {
596
605
  continue;
597
606
  }
598
- const concat = node.concatTokens().toUpperCase();
607
+ const concat = high.concatTokens().toUpperCase();
599
608
  if (concat.includes(" LINE_EXISTS( ") || concat.includes(" LINE_INDEX( ")) {
600
609
  // note: line_exists() must be replaced before handling table expressions
601
610
  continue;
@@ -615,10 +624,10 @@ ${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
615
624
  continue;
616
625
  }
617
626
  const condition = this.tableCondition(tableExpression);
618
- const uniqueName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
619
- const tabixBackup = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
620
- const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
621
- 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();
622
631
  // note that the tabix restore should be done before throwing the exception
623
632
  const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${pre}.
624
633
  ${indentation}DATA ${tabixBackup} LIKE sy-tabix.
@@ -631,7 +640,7 @@ ${indentation}ENDIF.
631
640
  ${indentation}`);
632
641
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, startToken.getStart(), tableExpression.getLastToken().getEnd(), uniqueName);
633
642
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
634
- 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);
635
644
  }
636
645
  return undefined;
637
646
  }
@@ -813,7 +822,10 @@ ${indentation}RAISE EXCEPTION ${uniqueName2}.`;
813
822
  const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), abap);
814
823
  return issue_1.Issue.atToken(lowFile, startToken, "Downport RAISE MESSAGE", this.getMetadata().key, this.conf.severity, fix);
815
824
  }
816
- emptyKey(node, lowFile) {
825
+ emptyKey(low, node, lowFile) {
826
+ if (!(low.get() instanceof _statement_1.Unknown)) {
827
+ return undefined;
828
+ }
817
829
  for (let i of node.findAllExpressions(Expressions.TypeTable)) {
818
830
  const key = i.findDirectExpression(Expressions.TypeTableKey);
819
831
  if (key === undefined) {
@@ -962,7 +974,10 @@ LOOP AT ${groupTargetName}tab ${groupTarget}.`;
962
974
  }
963
975
  return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport, LOOP GROUP", this.getMetadata().key, this.conf.severity, fix);
964
976
  }
965
- downportRef(high, lowFile, highSyntax) {
977
+ downportRef(low, high, lowFile, highSyntax) {
978
+ if (!(low.get() instanceof _statement_1.Unknown)) {
979
+ return undefined;
980
+ }
966
981
  let found = undefined;
967
982
  for (const s of high.findAllExpressionsRecursive(Expressions.Source)) {
968
983
  if (s.getFirstToken().getStr().toUpperCase() === "REF"
@@ -980,8 +995,11 @@ LOOP AT ${groupTargetName}tab ${groupTarget}.`;
980
995
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
981
996
  return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport, REF", this.getMetadata().key, this.conf.severity, fix);
982
997
  }
983
- assignWithTable(high, lowFile) {
998
+ assignWithTable(low, high, lowFile) {
984
999
  var _a, _b;
1000
+ if (!(low.get() instanceof _statement_1.Unknown)) {
1001
+ return undefined;
1002
+ }
985
1003
  if (!(high.get() instanceof Statements.Assign)) {
986
1004
  return undefined;
987
1005
  }
@@ -1016,7 +1034,10 @@ LOOP AT ${groupTargetName}tab ${groupTarget}.`;
1016
1034
  const fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);
1017
1035
  return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport, ASSIGN table expr", this.getMetadata().key, this.conf.severity, fix);
1018
1036
  }
1019
- moveWithSimpleValue(high, lowFile) {
1037
+ moveWithSimpleValue(low, high, lowFile) {
1038
+ if (!(low.get() instanceof _statement_1.Unknown)) {
1039
+ return undefined;
1040
+ }
1020
1041
  if (!(high.get() instanceof Statements.Move)
1021
1042
  || high.getChildren().length !== 4) {
1022
1043
  return undefined;
@@ -1081,8 +1102,11 @@ CONSTANTS: BEGIN OF ${structureName},\n`;
1081
1102
  const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);
1082
1103
  return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport ENUM", this.getMetadata().key, this.conf.severity, fix);
1083
1104
  }
1084
- moveWithTableTarget(node, high, lowFile, highSyntax) {
1105
+ moveWithTableTarget(low, high, lowFile, highSyntax) {
1085
1106
  var _a;
1107
+ if (!(low.get() instanceof _statement_1.Unknown)) {
1108
+ return undefined;
1109
+ }
1086
1110
  if (!(high.get() instanceof Statements.Move)) {
1087
1111
  return undefined;
1088
1112
  }
@@ -1098,11 +1122,11 @@ CONSTANTS: BEGIN OF ${structureName},\n`;
1098
1122
  if (index === undefined) {
1099
1123
  return undefined;
1100
1124
  }
1101
- let uniqueName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
1125
+ let uniqueName = this.uniqueName(low.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
1102
1126
  uniqueName = `<${uniqueName}>`;
1103
1127
  const tName = target.concatTokens().split("[")[0];
1104
1128
  const condition = this.tableCondition(tableExpression);
1105
- const tabixBackup = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
1129
+ const tabixBackup = this.uniqueName(low.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
1106
1130
  const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
1107
1131
  // restore tabix before exeption
1108
1132
  const code = `FIELD-SYMBOLS ${uniqueName} LIKE LINE OF ${tName}.
@@ -1122,9 +1146,12 @@ ${indentation}${uniqueName}`;
1122
1146
  const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);
1123
1147
  return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport, move with table target", this.getMetadata().key, this.conf.severity, fix);
1124
1148
  }
1125
- moveWithOperator(high, lowFile) {
1149
+ moveWithOperator(low, high, lowFile) {
1126
1150
  var _a, _b, _c;
1127
- 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)) {
1128
1155
  return undefined;
1129
1156
  }
1130
1157
  const children = high.getChildren();
@@ -1165,12 +1192,15 @@ ${indentation}${uniqueName}`;
1165
1192
  return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Expand operator", this.getMetadata().key, this.conf.severity, fix);
1166
1193
  }
1167
1194
  // must be very simple string templates, like "|{ ls_line-no ALPHA = IN }|"
1168
- stringTemplateAlpha(node, lowFile, highSyntax) {
1195
+ stringTemplateAlpha(low, high, lowFile, highSyntax) {
1169
1196
  var _a, _b, _c;
1170
- if (!(node.get() instanceof Statements.Move)) {
1197
+ if (!(low.get() instanceof _statement_1.Unknown)) {
1171
1198
  return undefined;
1172
1199
  }
1173
- const topSource = node.findDirectExpression(Expressions.Source);
1200
+ else if (!(high.get() instanceof Statements.Move)) {
1201
+ return undefined;
1202
+ }
1203
+ const topSource = high.findDirectExpression(Expressions.Source);
1174
1204
  if (topSource === undefined || topSource.getChildren().length !== 1) {
1175
1205
  return undefined;
1176
1206
  }
@@ -1202,10 +1232,10 @@ ${indentation}${uniqueName}`;
1202
1232
  default:
1203
1233
  return undefined;
1204
1234
  }
1205
- const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
1235
+ const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
1206
1236
  const source = (_b = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();
1207
- const topTarget = (_c = node.findDirectExpression(Expressions.Target)) === null || _c === void 0 ? void 0 : _c.concatTokens();
1208
- 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);
1209
1239
  if (top === false) {
1210
1240
  const code = `DATA ${uniqueName} TYPE string.
1211
1241
  ${indentation}CALL FUNCTION '${functionName}'
@@ -1213,10 +1243,10 @@ ${indentation} EXPORTING
1213
1243
  ${indentation} input = ${source}
1214
1244
  ${indentation} IMPORTING
1215
1245
  ${indentation} output = ${uniqueName}.\n`;
1216
- 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);
1217
1247
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, child.getFirstToken().getStart(), child.getLastToken().getEnd(), uniqueName);
1218
1248
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
1219
- 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);
1220
1250
  }
1221
1251
  else {
1222
1252
  const code = `CALL FUNCTION '${functionName}'
@@ -1224,29 +1254,32 @@ ${indentation} EXPORTING
1224
1254
  ${indentation} input = ${source}
1225
1255
  ${indentation} IMPORTING
1226
1256
  ${indentation} output = ${topTarget}.`;
1227
- const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getFirstToken().getStart(), node.getLastToken().getEnd(), code);
1228
- 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);
1229
1259
  }
1230
1260
  }
1231
- outlineLoopInput(node, lowFile, highSyntax) {
1232
- if (!(node.get() instanceof Statements.Loop)) {
1261
+ outlineLoopInput(low, high, lowFile, highSyntax) {
1262
+ if (!(low.get() instanceof _statement_1.Unknown)) {
1233
1263
  return undefined;
1234
1264
  }
1235
- else if (node.findDirectExpression(Expressions.SimpleSource2)) {
1265
+ else if (!(high.get() instanceof Statements.Loop)) {
1266
+ return undefined;
1267
+ }
1268
+ else if (high.findDirectExpression(Expressions.SimpleSource2)) {
1236
1269
  return undefined;
1237
1270
  }
1238
1271
  // the first Source must be outlined
1239
- const s = node.findDirectExpression(Expressions.Source);
1272
+ const s = high.findDirectExpression(Expressions.Source);
1240
1273
  if (s === undefined) {
1241
1274
  return undefined;
1242
1275
  }
1243
- const uniqueName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
1276
+ const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
1244
1277
  const code = `DATA(${uniqueName}) = ${s.concatTokens()}.\n` +
1245
- " ".repeat(node.getFirstToken().getStart().getCol() - 1);
1246
- 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);
1247
1280
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, s.getFirstToken().getStart(), s.getLastToken().getEnd(), uniqueName);
1248
1281
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
1249
- 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);
1250
1283
  }
1251
1284
  outlineLoopTarget(node, lowFile, _highSyntax) {
1252
1285
  var _a, _b, _c, _d, _e, _f, _g;
@@ -1335,19 +1368,22 @@ ${indentation} output = ${topTarget}.`;
1335
1368
  }
1336
1369
  return { body, end };
1337
1370
  }
1338
- outlineSwitch(node, lowFile, highSyntax) {
1371
+ outlineSwitch(low, high, lowFile, highSyntax) {
1339
1372
  var _a, _b, _c, _d;
1340
- 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)) {
1341
1377
  const firstToken = i.getFirstToken();
1342
1378
  if (firstToken.getStr().toUpperCase() !== "SWITCH") {
1343
1379
  continue;
1344
1380
  }
1345
1381
  let type = this.findType(i, lowFile, highSyntax);
1346
1382
  if (type === undefined) {
1347
- if (node.get() instanceof Statements.Move
1348
- && node.findDirectExpression(Expressions.Source) === i
1349
- && ((_a = node.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.TargetField)) !== undefined) {
1350
- 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());
1351
1387
  }
1352
1388
  if (type === undefined) {
1353
1389
  continue;
@@ -1357,7 +1393,7 @@ ${indentation} output = ${topTarget}.`;
1357
1393
  type = "TYPE " + type;
1358
1394
  }
1359
1395
  const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
1360
- const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
1396
+ const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
1361
1397
  let body = "";
1362
1398
  let name = "";
1363
1399
  const switchBody = i.findDirectExpression(Expressions.SwitchBody);
@@ -1399,16 +1435,19 @@ ${indentation} output = ${topTarget}.`;
1399
1435
  }
1400
1436
  }
1401
1437
  body += "\n" + indentation + "ENDCASE.\n" + indentation;
1402
- 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);
1403
1439
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), i.getLastToken().getEnd(), uniqueName);
1404
1440
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
1405
1441
  return issue_1.Issue.atToken(lowFile, firstToken, "Downport SWITCH", this.getMetadata().key, this.conf.severity, fix);
1406
1442
  }
1407
1443
  return undefined;
1408
1444
  }
1409
- outlineReduce(node, lowFile, highSyntax) {
1445
+ outlineReduce(low, high, lowFile, highSyntax) {
1410
1446
  var _a, _b;
1411
- 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)) {
1412
1451
  const firstToken = i.getFirstToken();
1413
1452
  if (firstToken.getStr().toUpperCase() !== "REDUCE") {
1414
1453
  continue;
@@ -1418,7 +1457,7 @@ ${indentation} output = ${topTarget}.`;
1418
1457
  continue;
1419
1458
  }
1420
1459
  const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
1421
- const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
1460
+ const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
1422
1461
  let body = "";
1423
1462
  let name = "";
1424
1463
  const reduceBody = i.findDirectExpression(Expressions.ReduceBody);
@@ -1474,16 +1513,19 @@ ${indentation} output = ${topTarget}.`;
1474
1513
  const abap = `DATA ${uniqueName} TYPE ${type}.\n` +
1475
1514
  body +
1476
1515
  indentation;
1477
- 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);
1478
1517
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), i.getLastToken().getEnd(), uniqueName);
1479
1518
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
1480
1519
  return issue_1.Issue.atToken(lowFile, firstToken, "Downport REDUCE", this.getMetadata().key, this.conf.severity, fix);
1481
1520
  }
1482
1521
  return undefined;
1483
1522
  }
1484
- outlineValue(node, lowFile, highSyntax) {
1523
+ outlineValue(low, high, lowFile, highSyntax) {
1485
1524
  var _a, _b, _c;
1486
- 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);
1487
1529
  for (const s of allSources) {
1488
1530
  const firstToken = s.getFirstToken();
1489
1531
  if (firstToken.getStr().toUpperCase() !== "VALUE") {
@@ -1491,8 +1533,8 @@ ${indentation} output = ${topTarget}.`;
1491
1533
  }
1492
1534
  let type = this.findType(s, lowFile, highSyntax);
1493
1535
  if (type === undefined) {
1494
- if (node.get() instanceof Statements.Move && node.findDirectExpression(Expressions.Source) === s) {
1495
- 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());
1496
1538
  }
1497
1539
  if (type === undefined) {
1498
1540
  continue;
@@ -1503,7 +1545,7 @@ ${indentation} output = ${topTarget}.`;
1503
1545
  }
1504
1546
  const valueBody = s.findDirectExpression(Expressions.ValueBody);
1505
1547
  const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
1506
- let indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
1548
+ let indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
1507
1549
  let body = "";
1508
1550
  const base = valueBody === null || valueBody === void 0 ? void 0 : valueBody.findExpressionAfterToken("BASE");
1509
1551
  if (base) {
@@ -1610,7 +1652,7 @@ ${indentation} output = ${topTarget}.`;
1610
1652
  indentation + `CLEAR ${uniqueName}.\n` + // might be called inside a loop
1611
1653
  body +
1612
1654
  indentation;
1613
- 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);
1614
1656
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), s.getLastToken().getEnd(), uniqueName);
1615
1657
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
1616
1658
  return issue_1.Issue.atToken(lowFile, firstToken, "Downport VALUE", this.getMetadata().key, this.conf.severity, fix);
@@ -1682,17 +1724,20 @@ ${indentation} output = ${topTarget}.`;
1682
1724
  return (_a = inferred.getType().getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toLowerCase();
1683
1725
  }
1684
1726
  }
1685
- outlineFS(node, lowFile, highSyntax) {
1727
+ outlineFS(low, high, lowFile, highSyntax) {
1686
1728
  var _a, _b;
1687
- 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)) {
1688
1733
  const nameToken = (_a = i.findDirectExpression(Expressions.TargetFieldSymbol)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
1689
1734
  if (nameToken === undefined) {
1690
1735
  continue;
1691
1736
  }
1692
1737
  const name = nameToken.getStr();
1693
1738
  let type = "";
1694
- if (node.concatTokens().toUpperCase().startsWith("APPEND INITIAL LINE TO ")) {
1695
- 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());
1696
1741
  }
1697
1742
  else {
1698
1743
  const spag = highSyntax.spaghetti.lookupPosition(nameToken.getStart(), lowFile.getFilename());
@@ -1710,8 +1755,8 @@ ${indentation} output = ${topTarget}.`;
1710
1755
  type += found.getType().getQualifiedName() ? found.getType().getQualifiedName().toLowerCase() : found.getType().toABAP();
1711
1756
  }
1712
1757
  const code = `FIELD-SYMBOLS ${name} ${type}.\n` +
1713
- " ".repeat(node.getFirstToken().getStart().getCol() - 1);
1714
- 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);
1715
1760
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), name);
1716
1761
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
1717
1762
  return issue_1.Issue.atToken(lowFile, i.getFirstToken(), "Outline FIELD-SYMBOL", this.getMetadata().key, this.conf.severity, fix);
@@ -1719,6 +1764,7 @@ ${indentation} output = ${topTarget}.`;
1719
1764
  return undefined;
1720
1765
  }
1721
1766
  outlineData(node, lowFile, highSyntax) {
1767
+ // hmm, no guard here, as DATA(SDF) is valid in 702
1722
1768
  var _a, _b;
1723
1769
  for (const i of node.findAllExpressionsRecursive(Expressions.InlineData)) {
1724
1770
  const nameToken = (_a = i.findDirectExpression(Expressions.TargetField)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
@@ -1750,9 +1796,12 @@ ${indentation} output = ${topTarget}.`;
1750
1796
  }
1751
1797
  return undefined;
1752
1798
  }
1753
- outlineCond(node, lowFile, highSyntax) {
1799
+ outlineCond(low, high, lowFile, highSyntax) {
1754
1800
  var _a, _b;
1755
- 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)) {
1756
1805
  if (i.getFirstToken().getStr().toUpperCase() !== "COND") {
1757
1806
  continue;
1758
1807
  }
@@ -1763,10 +1812,10 @@ ${indentation} output = ${topTarget}.`;
1763
1812
  const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
1764
1813
  let type = this.findType(i, lowFile, highSyntax);
1765
1814
  if (type === undefined) {
1766
- if (node.get() instanceof Statements.Move
1767
- && node.findDirectExpression(Expressions.Source) === i
1768
- && ((_a = node.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.TargetField)) !== undefined) {
1769
- 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());
1770
1819
  }
1771
1820
  if (type === undefined) {
1772
1821
  continue;
@@ -1775,10 +1824,10 @@ ${indentation} output = ${topTarget}.`;
1775
1824
  else {
1776
1825
  type = "TYPE " + type;
1777
1826
  }
1778
- const indent = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
1827
+ const indent = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
1779
1828
  const bodyCode = this.buildCondBody(body, uniqueName, indent, lowFile, highSyntax);
1780
1829
  const abap = `DATA ${uniqueName} ${type}.\n` + bodyCode;
1781
- 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);
1782
1831
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), uniqueName);
1783
1832
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
1784
1833
  return issue_1.Issue.atToken(lowFile, i.getFirstToken(), "Downport COND", this.getMetadata().key, this.conf.severity, fix);
@@ -1834,9 +1883,12 @@ ${indentation} output = ${topTarget}.`;
1834
1883
  code += indent;
1835
1884
  return code;
1836
1885
  }
1837
- outlineConv(node, lowFile, highSyntax) {
1886
+ outlineConv(low, high, lowFile, highSyntax) {
1838
1887
  var _a;
1839
- 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)) {
1840
1892
  if (i.getFirstToken().getStr().toUpperCase() !== "CONV") {
1841
1893
  continue;
1842
1894
  }
@@ -1850,11 +1902,11 @@ ${indentation} output = ${topTarget}.`;
1850
1902
  }
1851
1903
  const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
1852
1904
  const type = this.findType(i, lowFile, highSyntax);
1853
- const indent = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
1905
+ const indent = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
1854
1906
  const abap = `DATA ${uniqueName} TYPE ${type}.\n` +
1855
1907
  indent + `${uniqueName} = ${body}.\n` +
1856
1908
  indent;
1857
- 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);
1858
1910
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), end.getEnd(), uniqueName);
1859
1911
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
1860
1912
  return issue_1.Issue.atToken(lowFile, i.getFirstToken(), "Downport CONV", this.getMetadata().key, this.conf.severity, fix);
@@ -1862,17 +1914,20 @@ ${indentation} output = ${topTarget}.`;
1862
1914
  return undefined;
1863
1915
  }
1864
1916
  // "CAST" to "?="
1865
- outlineCast(node, lowFile, highSyntax) {
1917
+ outlineCast(low, high, lowFile, highSyntax) {
1866
1918
  var _a;
1867
- 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)) {
1868
1923
  const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
1869
1924
  const type = this.findType(i, lowFile, highSyntax, true);
1870
1925
  const body = (_a = i.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();
1871
1926
  const abap = `DATA ${uniqueName} TYPE ${type}.\n` +
1872
- " ".repeat(node.getFirstToken().getStart().getCol() - 1) +
1927
+ " ".repeat(high.getFirstToken().getStart().getCol() - 1) +
1873
1928
  `${uniqueName} ?= ${body}.\n` +
1874
- " ".repeat(node.getFirstToken().getStart().getCol() - 1);
1875
- 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);
1876
1931
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), uniqueName);
1877
1932
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
1878
1933
  return issue_1.Issue.atToken(lowFile, i.getFirstToken(), "Downport CAST", this.getMetadata().key, this.conf.severity, fix);
@@ -1916,14 +1971,17 @@ ${indentation} output = ${topTarget}.`;
1916
1971
  }
1917
1972
  return undefined;
1918
1973
  }
1919
- replaceMethodConditional(node, lowFile, highSyntax) {
1920
- 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)) {
1921
1979
  const chain = c.findDirectExpression(Expressions.MethodCallChain);
1922
1980
  if (chain === undefined) {
1923
1981
  continue;
1924
1982
  }
1925
1983
  let predicate = false;
1926
- const spag = highSyntax.spaghetti.lookupPosition(node.getFirstToken().getStart(), lowFile.getFilename());
1984
+ const spag = highSyntax.spaghetti.lookupPosition(high.getFirstToken().getStart(), lowFile.getFilename());
1927
1985
  for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {
1928
1986
  if (r.referenceType === _reference_1.ReferenceType.BuiltinMethodReference &&
1929
1987
  new _builtin_1.BuiltIn().isPredicate(chain.getFirstToken().getStr().toUpperCase())) {
@@ -2044,13 +2102,16 @@ ${indentation} output = ${topTarget}.`;
2044
2102
  }
2045
2103
  return undefined;
2046
2104
  }
2047
- newToCreateObject(node, lowFile, highSyntax) {
2048
- 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);
2049
2110
  let fix = undefined;
2050
- if (node.get() instanceof Statements.Move
2111
+ if (high.get() instanceof Statements.Move
2051
2112
  && source
2052
2113
  && source.getFirstToken().getStr().toUpperCase() === "NEW") {
2053
- const target = node.findDirectExpression(Expressions.Target);
2114
+ const target = high.findDirectExpression(Expressions.Target);
2054
2115
  const found = source === null || source === void 0 ? void 0 : source.findFirstExpression(Expressions.NewObject);
2055
2116
  // must be at top level of the source for quickfix to work(todo: handle more scenarios)
2056
2117
  if (target
@@ -2059,12 +2120,12 @@ ${indentation} output = ${topTarget}.`;
2059
2120
  && target.findDirectExpression(Expressions.InlineData) === undefined) {
2060
2121
  const abap = this.newParameters(found, target.concatTokens(), highSyntax, lowFile);
2061
2122
  if (abap !== undefined) {
2062
- 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);
2063
2124
  }
2064
2125
  }
2065
2126
  }
2066
- if (fix === undefined && node.findAllExpressions(Expressions.NewObject)) {
2067
- const found = node.findFirstExpression(Expressions.NewObject);
2127
+ if (fix === undefined && high.findAllExpressions(Expressions.NewObject)) {
2128
+ const found = high.findFirstExpression(Expressions.NewObject);
2068
2129
  if (found === undefined) {
2069
2130
  return undefined;
2070
2131
  }
@@ -2074,16 +2135,16 @@ ${indentation} output = ${topTarget}.`;
2074
2135
  return undefined;
2075
2136
  }
2076
2137
  const type = this.findType(found, lowFile, highSyntax);
2077
- const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
2138
+ const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
2078
2139
  const data = `DATA ${name} TYPE REF TO ${type}.\n` +
2079
2140
  indentation + abap + "\n" +
2080
2141
  indentation;
2081
- 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);
2082
2143
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, found.getFirstToken().getStart(), found.getLastToken().getEnd(), name);
2083
2144
  fix = edit_helper_1.EditHelper.merge(fix2, fix1);
2084
2145
  }
2085
2146
  if (fix) {
2086
- 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);
2087
2148
  }
2088
2149
  else {
2089
2150
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.93.1",
3
+ "version": "2.93.2",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",