@abaplint/core 2.85.30 → 2.85.31

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.
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.85.30";
71
+ return "2.85.31";
72
72
  }
73
73
  getDDICReferences() {
74
74
  return this.references;
@@ -307,7 +307,7 @@ Only one transformation is applied to a statement at a time, so multiple steps m
307
307
  return undefined;
308
308
  }
309
309
  downportSelectSingleInline(_low, high, lowFile, _highSyntax) {
310
- var _a, _b, _c;
310
+ var _a, _b, _c, _d;
311
311
  const targets = ((_a = high.findFirstExpression(Expressions.SQLIntoStructure)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(Expressions.SQLTarget)) || [];
312
312
  if (targets.length !== 1) {
313
313
  return undefined;
@@ -341,6 +341,13 @@ Only one transformation is applied to a statement at a time, so multiple steps m
341
341
  else if (fieldList.concatTokens().toUpperCase() === "COUNT( * )") {
342
342
  fieldDefinition = `DATA ${name} TYPE i.`;
343
343
  }
344
+ else if (fieldList.getChildren().length === 1 && fieldList.getChildren()[0].get() instanceof Expressions.SQLAggregation) {
345
+ const c = fieldList.getChildren()[0];
346
+ if (c instanceof nodes_1.ExpressionNode) {
347
+ const concat = (_d = c.findFirstExpression(Expressions.SQLArithmetics)) === null || _d === void 0 ? void 0 : _d.concatTokens();
348
+ fieldDefinition = `DATA ${name} TYPE ${tableName}-${concat}.`;
349
+ }
350
+ }
344
351
  else {
345
352
  for (const f of fields) {
346
353
  const fieldName = f.concatTokens();
@@ -477,6 +484,7 @@ ${indentation}`);
477
484
  if (!(((_a = target === null || target === void 0 ? void 0 : target.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.InlineData)) {
478
485
  return undefined;
479
486
  }
487
+ let type = "";
480
488
  const source = node.findFirstExpression(Expressions.Source);
481
489
  if (source === undefined) {
482
490
  return undefined;
@@ -494,13 +502,25 @@ ${indentation}`);
494
502
  return undefined;
495
503
  }
496
504
  else if (source.findFirstExpression(Expressions.TableExpression)) {
497
- return undefined;
505
+ const chain = source.findDirectExpression(Expressions.FieldChain);
506
+ if (chain !== undefined
507
+ && chain.getChildren().length === 2
508
+ && chain.getChildren()[0].get() instanceof Expressions.SourceField
509
+ && chain.getChildren()[1].get() instanceof Expressions.TableExpression) {
510
+ type = "LINE OF " + chain.getChildren()[0].concatTokens();
511
+ }
512
+ else {
513
+ return undefined;
514
+ }
515
+ }
516
+ else {
517
+ type = source.concatTokens();
498
518
  }
499
519
  const targetName = (_c = target.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens();
500
520
  const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
501
521
  const firstToken = node.getFirstToken();
502
522
  const lastToken = node.getLastToken();
503
- const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${targetName} LIKE ${source.concatTokens()}.\n${indentation}`);
523
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${targetName} LIKE ${type}.\n${indentation}`);
504
524
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), lastToken.getEnd(), `${targetName} = ${source.concatTokens()}.`);
505
525
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
506
526
  return issue_1.Issue.atToken(lowFile, node.getFirstToken(), "Outline DATA", this.getMetadata().key, this.conf.severity, fix);
@@ -1007,15 +1027,22 @@ ${indentation} output = ${topTarget}.`;
1007
1027
  if (spag === undefined) {
1008
1028
  continue;
1009
1029
  }
1010
- const found = spag.findVariable(name);
1011
- if (found === undefined) {
1012
- continue;
1030
+ let type = "";
1031
+ if (node.concatTokens().toUpperCase().startsWith("APPEND INITIAL LINE TO ")) {
1032
+ type = "LIKE LINE OF " + ((_b = node.findFirstExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens());
1013
1033
  }
1014
- else if (found.getType() instanceof basic_1.VoidType) {
1015
- return issue_1.Issue.atToken(lowFile, i.getFirstToken(), "Error outlining voided type", this.getMetadata().key, this.conf.severity);
1034
+ else {
1035
+ const found = spag.findVariable(name);
1036
+ if (found === undefined) {
1037
+ continue;
1038
+ }
1039
+ else if (found.getType() instanceof basic_1.VoidType) {
1040
+ return issue_1.Issue.atToken(lowFile, i.getFirstToken(), "Error outlining voided type", this.getMetadata().key, this.conf.severity);
1041
+ }
1042
+ type = "TYPE ";
1043
+ type += found.getType().getQualifiedName() ? found.getType().getQualifiedName().toLowerCase() : found.getType().toABAP();
1016
1044
  }
1017
- const type = found.getType().getQualifiedName() ? (_b = found.getType().getQualifiedName()) === null || _b === void 0 ? void 0 : _b.toLowerCase() : found.getType().toABAP();
1018
- const code = `FIELD-SYMBOLS ${name} TYPE ${type}.\n` +
1045
+ const code = `FIELD-SYMBOLS ${name} ${type}.\n` +
1019
1046
  " ".repeat(node.getFirstToken().getStart().getCol() - 1);
1020
1047
  const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);
1021
1048
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.85.30",
3
+ "version": "2.85.31",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",