@abaplint/core 2.98.1 → 2.98.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.
@@ -1966,6 +1966,7 @@ declare namespace Expressions {
1966
1966
  ComponentCondSub,
1967
1967
  ComponentCond,
1968
1968
  ComponentName,
1969
+ SQLFields,
1969
1970
  ConcatenatedConstant,
1970
1971
  CondBody,
1971
1972
  CondSub,
@@ -5278,6 +5279,10 @@ declare class SQLFieldName extends Expression {
5278
5279
  getRunnable(): IStatementRunnable;
5279
5280
  }
5280
5281
 
5282
+ declare class SQLFields extends Expression {
5283
+ getRunnable(): IStatementRunnable;
5284
+ }
5285
+
5281
5286
  declare class SQLForAllEntries extends Expression {
5282
5287
  getRunnable(): IStatementRunnable;
5283
5288
  }
@@ -43,6 +43,7 @@ __exportStar(require("./component_compare"), exports);
43
43
  __exportStar(require("./component_cond_sub"), exports);
44
44
  __exportStar(require("./component_cond"), exports);
45
45
  __exportStar(require("./component_name"), exports);
46
+ __exportStar(require("./sql_fields"), exports);
46
47
  __exportStar(require("./concatenated_constant"), exports);
47
48
  __exportStar(require("./cond_body"), exports);
48
49
  __exportStar(require("./cond_sub"), exports);
@@ -15,7 +15,7 @@ class Select extends combi_1.Expression {
15
15
  const where = (0, combi_1.seq)("WHERE", _1.SQLCond);
16
16
  const offset = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)("OFFSET", _1.SQLSource));
17
17
  const bypass = (0, combi_1.str)("BYPASSING BUFFER");
18
- const fields = (0, combi_1.seq)("FIELDS", _1.SQLFieldList);
18
+ const fields = (0, combi_1.ver)(version_1.Version.v750, _1.SQLFields);
19
19
  const perm = (0, combi_1.per)(_1.SQLFrom, into, _1.SQLForAllEntries, where, _1.SQLOrderBy, sql_up_to_1.SQLUpTo, offset, _1.SQLClient, _1.SQLHaving, bypass, sql_group_by_1.SQLGroupBy, fields, _1.DatabaseConnection);
20
20
  const permSingle = (0, combi_1.per)(_1.SQLFrom, sql_into_structure_1.SQLIntoStructure, where, _1.SQLClient, bypass, fields, _1.DatabaseConnection);
21
21
  const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), sql_field_name_1.SQLFieldName, (0, combi_1.tok)(tokens_1.WParenRightW));
@@ -6,10 +6,10 @@ const _1 = require(".");
6
6
  const sql_order_by_1 = require("./sql_order_by");
7
7
  const sql_having_1 = require("./sql_having");
8
8
  const sql_into_structure_1 = require("./sql_into_structure");
9
- const sql_field_list_1 = require("./sql_field_list");
10
9
  const sql_hints_1 = require("./sql_hints");
11
10
  const sql_field_list_loop_1 = require("./sql_field_list_loop");
12
11
  const sql_up_to_1 = require("./sql_up_to");
12
+ const version_1 = require("../../../version");
13
13
  class SelectLoop extends combi_1.Expression {
14
14
  getRunnable() {
15
15
  const where = (0, combi_1.seq)("WHERE", _1.SQLCond);
@@ -18,7 +18,7 @@ class SelectLoop extends combi_1.Expression {
18
18
  const tab = (0, combi_1.seq)(_1.SQLIntoTable, (0, combi_1.alt)(pack, (0, combi_1.seq)(_1.SQLFrom, pack), (0, combi_1.seq)(pack, _1.SQLFrom)));
19
19
  const packTab = (0, combi_1.seq)(pack, _1.SQLIntoTable);
20
20
  const perm = (0, combi_1.per)(_1.SQLFrom, where, sql_up_to_1.SQLUpTo, sql_order_by_1.SQLOrderBy, sql_having_1.SQLHaving, _1.SQLClient, bypass, _1.SQLGroupBy, _1.SQLForAllEntries, (0, combi_1.alt)(tab, sql_into_structure_1.SQLIntoStructure, packTab));
21
- const strict = (0, combi_1.seq)(_1.SQLFrom, "FIELDS", sql_field_list_1.SQLFieldList, where, sql_into_structure_1.SQLIntoStructure, sql_up_to_1.SQLUpTo);
21
+ const strict = (0, combi_1.seq)(_1.SQLFrom, (0, combi_1.ver)(version_1.Version.v750, _1.SQLFields), where, sql_into_structure_1.SQLIntoStructure, sql_up_to_1.SQLUpTo);
22
22
  const ret = (0, combi_1.seq)("SELECT", (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.optPrio)("DISTINCT"), sql_field_list_loop_1.SQLFieldListLoop, perm), strict), (0, combi_1.optPrio)(sql_hints_1.SQLHints));
23
23
  return ret;
24
24
  }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SQLFields = void 0;
4
+ const combi_1 = require("../combi");
5
+ const _1 = require(".");
6
+ class SQLFields extends combi_1.Expression {
7
+ getRunnable() {
8
+ return (0, combi_1.seq)("FIELDS", _1.SQLFieldList);
9
+ }
10
+ }
11
+ exports.SQLFields = SQLFields;
12
+ //# sourceMappingURL=sql_fields.js.map
@@ -63,7 +63,7 @@ class Registry {
63
63
  }
64
64
  static abaplintVersion() {
65
65
  // magic, see build script "version.sh"
66
- return "2.98.1";
66
+ return "2.98.3";
67
67
  }
68
68
  getDDICReferences() {
69
69
  return this.references;
@@ -428,6 +428,10 @@ Only one transformation is applied to a statement at a time, so multiple steps m
428
428
  return found;
429
429
  }
430
430
  }
431
+ found = this.downportSelectFields(low, high, lowFile, highSyntax);
432
+ if (found) {
433
+ return found;
434
+ }
431
435
  found = this.outlineSwitch(low, high, lowFile, highSyntax);
432
436
  if (found) {
433
437
  return found;
@@ -597,6 +601,27 @@ Only one transformation is applied to a statement at a time, so multiple steps m
597
601
  }
598
602
  return undefined;
599
603
  }
604
+ downportSelectFields(low, high, lowFile, _highSyntax) {
605
+ var _a;
606
+ if (!(low.get() instanceof _statement_1.Unknown)) {
607
+ return undefined;
608
+ }
609
+ else if (!(high.get() instanceof Statements.Select)) {
610
+ return undefined;
611
+ }
612
+ const fields = high.findFirstExpression(Expressions.SQLFields);
613
+ if (fields === undefined) {
614
+ return undefined;
615
+ }
616
+ const code = (_a = fields.getLastChild()) === null || _a === void 0 ? void 0 : _a.concatTokens();
617
+ if (code === undefined) {
618
+ return undefined;
619
+ }
620
+ const fix1 = edit_helper_1.EditHelper.deleteRange(lowFile, fields.getFirstToken().getStart(), fields.getLastToken().getEnd());
621
+ const fix2 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getEnd(), " " + code);
622
+ const fix = edit_helper_1.EditHelper.merge(fix1, fix2);
623
+ return issue_1.Issue.atToken(lowFile, fields.getFirstToken(), "Replace FIELDS", this.getMetadata().key, this.conf.severity, fix);
624
+ }
600
625
  downportSelectSingleInline(low, high, lowFile, _highSyntax) {
601
626
  var _a, _b, _c, _d;
602
627
  if (!(low.get() instanceof _statement_1.Unknown)) {
@@ -47,7 +47,7 @@ DATA lt_bar TYPE STANDARD TABLE OF ty.`,
47
47
  const message = "Specify table type";
48
48
  issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
49
49
  }
50
- else if (concat.includes(" WITH ") === false) {
50
+ else if (concat.includes(" WITH ") === false && concat.includes(" RANGE OF ") === false) {
51
51
  const message = "Specify table key";
52
52
  issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
53
53
  }
@@ -63,6 +63,9 @@ class SelectSingleFullKey {
63
63
  }
64
64
  const tabl = this.findReference(databaseTable.getFirstToken().getStart(), syntax.spaghetti, file);
65
65
  const table = this.reg.getObject("TABL", tabl);
66
+ if (table === undefined) {
67
+ continue;
68
+ }
66
69
  const keys = table.listKeys(this.reg);
67
70
  // const type = table.parseType(this.reg);
68
71
  const cond = s.findFirstExpression(__1.Expressions.SQLCond);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.98.1",
3
+ "version": "2.98.3",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -47,10 +47,10 @@
47
47
  },
48
48
  "homepage": "https://abaplint.org",
49
49
  "devDependencies": {
50
- "@microsoft/api-extractor": "^7.34.4",
50
+ "@microsoft/api-extractor": "^7.34.5",
51
51
  "@types/chai": "^4.3.4",
52
52
  "@types/mocha": "^10.0.1",
53
- "@types/node": "^18.16.1",
53
+ "@types/node": "^18.16.2",
54
54
  "chai": "^4.3.7",
55
55
  "eslint": "^8.39.0",
56
56
  "mocha": "^10.2.0",