@abaplint/cli 2.119.45 → 2.119.46

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.
Files changed (2) hide show
  1. package/build/cli.js +55 -12
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -32672,7 +32672,7 @@ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/bui
32672
32672
  const version_1 = __webpack_require__(/*! ../../../version */ "../core/build/src/version.js");
32673
32673
  const isSimple = /^\w+$/;
32674
32674
  class Select {
32675
- static runSyntax(node, input, skipImplicitInto = false) {
32675
+ static runSyntax(node, input, skipImplicitInto = false, selectLoop = false) {
32676
32676
  var _a;
32677
32677
  const token = node.getFirstToken();
32678
32678
  let from = node.findDirectExpression(Expressions.SQLFrom);
@@ -32731,6 +32731,14 @@ class Select {
32731
32731
  sql_source_1.SQLSource.runSyntax(s, input);
32732
32732
  }
32733
32733
  for (const up of node.findDirectExpressions(Expressions.SQLUpTo)) {
32734
+ if (intoExpression
32735
+ && this.isStrictMode(node, input)
32736
+ && (selectLoop === false || input.scope.getLanguageVersion() === version_1.LanguageVersion.Cloud)
32737
+ && from.getFirstToken().getStart().isBefore(up.getFirstToken().getStart())
32738
+ && up.getFirstToken().getStart().isBefore(intoExpression.getFirstToken().getStart())) {
32739
+ const message = `The addition "UP TO n ROWS" must only be placed after the INTO/APPENDING clause.`;
32740
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, up.getFirstToken(), message));
32741
+ }
32734
32742
  for (const s of up.findDirectExpressions(Expressions.SQLSource)) {
32735
32743
  sql_source_1.SQLSource.runSyntax(s, input);
32736
32744
  }
@@ -32756,7 +32764,7 @@ class Select {
32756
32764
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, orderBy.getFirstToken(), message));
32757
32765
  }
32758
32766
  }
32759
- if (this.isStrictMode(node)) {
32767
+ if (this.isStrictMode(node, input)) {
32760
32768
  this.strictModeChecks(node, input);
32761
32769
  }
32762
32770
  if (input.scope.getType() === _scope_type_1.ScopeType.OpenSQL) {
@@ -32764,7 +32772,11 @@ class Select {
32764
32772
  }
32765
32773
  }
32766
32774
  // there are multiple rules, but gotta start somewhere
32767
- static isStrictMode(node) {
32775
+ static isStrictMode(node, input) {
32776
+ // strict OpenSQL is always required in the cloud language version
32777
+ if (input.scope.getLanguageVersion() === version_1.LanguageVersion.Cloud) {
32778
+ return true;
32779
+ }
32768
32780
  const into = node.findDirectExpressionsMulti([Expressions.SQLIntoList, Expressions.SQLIntoStructure, Expressions.SQLIntoTable])[0];
32769
32781
  const where = node.findDirectExpression(Expressions.SQLCond);
32770
32782
  // INTO is after WHERE
@@ -38188,8 +38200,9 @@ class DeleteInternal {
38188
38200
  const localVariable = input.scope.findVariable(target.concatTokens());
38189
38201
  if (localVariable === undefined && node.getChildren().length === 5 && node.getChildren()[2].concatTokens().toUpperCase() === "FROM") {
38190
38202
  // it might be a database table
38191
- tabl = (_a = input.scope.getDDIC()) === null || _a === void 0 ? void 0 : _a.lookupTableOrView(target.concatTokens());
38192
- if (tabl) {
38203
+ const found = (_a = input.scope.getDDIC()) === null || _a === void 0 ? void 0 : _a.lookupTableOrView(target.concatTokens());
38204
+ if ((found === null || found === void 0 ? void 0 : found.object) !== undefined) {
38205
+ tabl = found;
38193
38206
  input.scope.getDDICReferences().addUsing(input.scope.getParentObj(), { object: tabl.object });
38194
38207
  }
38195
38208
  }
@@ -38197,7 +38210,7 @@ class DeleteInternal {
38197
38210
  targetType = target_1.Target.runSyntax(target, input);
38198
38211
  if (node.findDirectTokenByText("TABLE") === undefined
38199
38212
  && node.findDirectTokenByText("ADJACENT") === undefined
38200
- && node.findDirectTokenByText("FROM")
38213
+ && (node.findDirectTokenByText("FROM") || node.findDirectTokenByText("INDEX"))
38201
38214
  && targetType instanceof basic_1.TableType
38202
38215
  && targetType.getAccessType() === basic_1.TableAccessType.hashed) {
38203
38216
  const message = "Implicit or explicit index operation on hashed table is not possible";
@@ -40762,6 +40775,14 @@ class Loop {
40762
40775
  }
40763
40776
  const targetConcat = loopTarget === null || loopTarget === void 0 ? void 0 : loopTarget.concatTokens().toUpperCase();
40764
40777
  const topType = sourceType; // todo: refactor topType vs sourceType vs rowType
40778
+ if (topType instanceof basic_1.TableType
40779
+ && topType.getAccessType() === basic_1.TableAccessType.hashed
40780
+ && node.findDirectTokenByText("USING") === undefined
40781
+ && (node.findDirectTokenByText("FROM") || node.findDirectTokenByText("TO"))) {
40782
+ const message = "Implicit or explicit index operation on hashed table is not possible";
40783
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
40784
+ return;
40785
+ }
40765
40786
  if (sourceType instanceof basic_1.TableType) {
40766
40787
  rowType = sourceType.getRowType();
40767
40788
  sourceType = rowType;
@@ -41304,6 +41325,13 @@ class ModifyInternal {
41304
41325
  // ok
41305
41326
  }
41306
41327
  else if (targetType instanceof basic_1.TableType) {
41328
+ if (node.findDirectTokenByText("TABLE") === undefined
41329
+ && node.findDirectTokenByText("INDEX")
41330
+ && targetType.getAccessType() === basic_1.TableAccessType.hashed) {
41331
+ const message = "Implicit or explicit index operation on hashed table is not possible";
41332
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
41333
+ return;
41334
+ }
41307
41335
  if (node.findDirectTokenByText("TABLE")
41308
41336
  && node.findDirectTokenByText("INDEX")
41309
41337
  && targetType.isWithHeader() === false) {
@@ -43203,7 +43231,7 @@ class SelectLoop {
43203
43231
  runSyntax(node, input) {
43204
43232
  const s = node.findDirectExpression(Expressions.Select);
43205
43233
  if (s) {
43206
- select_1.Select.runSyntax(s, input);
43234
+ select_1.Select.runSyntax(s, input, false, true);
43207
43235
  }
43208
43236
  }
43209
43237
  }
@@ -67395,7 +67423,7 @@ class Registry {
67395
67423
  }
67396
67424
  static abaplintVersion() {
67397
67425
  // magic, see build script "version.js"
67398
- return "2.119.45";
67426
+ return "2.119.46";
67399
67427
  }
67400
67428
  getDDICReferences() {
67401
67429
  return this.ddicReferences;
@@ -98434,7 +98462,25 @@ class Progress {
98434
98462
  this.bar.render();
98435
98463
  }
98436
98464
  }
98465
+ function validateVersion(version) {
98466
+ if (version === undefined) {
98467
+ return;
98468
+ }
98469
+ let known = false;
98470
+ if (typeof version === "string") {
98471
+ const vers = core_1.Version;
98472
+ known = Object.keys(core_1.Version).some(v => vers[v] === version);
98473
+ }
98474
+ else if (typeof version === "object" && typeof version.release === "string") {
98475
+ // new object form: {release, language}
98476
+ known = core_1.Release[version.release] !== undefined;
98477
+ }
98478
+ if (known === false) {
98479
+ throw "Error: Unknown version in abaplint.json";
98480
+ }
98481
+ }
98437
98482
  function loadConfig(filename) {
98483
+ var _a;
98438
98484
  // possible cases:
98439
98485
  // a) nothing specified, using abaplint.json from cwd
98440
98486
  // b) nothing specified, no abaplint.json in cwd
@@ -98474,10 +98520,7 @@ function loadConfig(filename) {
98474
98520
  process.stderr.write("Using config: " + f + "\n");
98475
98521
  const json = fs.readFileSync(f, "utf8");
98476
98522
  const parsed = JSON5.parse(json);
98477
- const vers = core_1.Version;
98478
- if (Object.keys(core_1.Version).some(v => vers[v] === parsed.syntax.version) === false) {
98479
- throw "Error: Unknown version in abaplint.json";
98480
- }
98523
+ validateVersion((_a = parsed.syntax) === null || _a === void 0 ? void 0 : _a.version);
98481
98524
  return {
98482
98525
  config: new core_1.Config(json),
98483
98526
  base: path.dirname(f) === process.cwd() ? "." : path.dirname(f),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.119.45",
3
+ "version": "2.119.46",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "homepage": "https://abaplint.org",
41
41
  "devDependencies": {
42
- "@abaplint/core": "^2.119.45",
42
+ "@abaplint/core": "^2.119.46",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",