@abaplint/transpiler-cli 2.5.73 → 2.5.75

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/bundle.js +41 -21
  2. package/package.json +3 -3
package/build/bundle.js CHANGED
@@ -8582,7 +8582,7 @@ const version_1 = __webpack_require__(/*! ../../../version */ "./node_modules/@a
8582
8582
  class CallFunction {
8583
8583
  getMatcher() {
8584
8584
  const starting = (0, combi_1.seq)("STARTING NEW TASK", expressions_1.SimpleSource2);
8585
- const update = (0, combi_1.str)("IN UPDATE TASK");
8585
+ const update = (0, combi_1.verNot)(version_1.Version.Cloud, (0, combi_1.str)("IN UPDATE TASK"));
8586
8586
  const unit = (0, combi_1.seq)("UNIT", expressions_1.Source);
8587
8587
  const background = (0, combi_1.verNot)(version_1.Version.Cloud, (0, combi_1.seq)("IN BACKGROUND", (0, combi_1.altPrio)("TASK", unit)));
8588
8588
  const calling = (0, combi_1.seq)("CALLING", expressions_1.MethodName, "ON END OF TASK");
@@ -20785,7 +20785,7 @@ class BasicTypes {
20785
20785
  return undefined;
20786
20786
  }
20787
20787
  parseTable(node, name) {
20788
- var _a, _b, _c;
20788
+ var _a, _b, _c, _d;
20789
20789
  const typename = node.findFirstExpression(Expressions.TypeName);
20790
20790
  const text = (_a = node.findFirstExpression(Expressions.TypeTable)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
20791
20791
  if (text === undefined) {
@@ -20808,7 +20808,8 @@ class BasicTypes {
20808
20808
  }
20809
20809
  const typeTableKeys = node.findAllExpressions(expressions_1.TypeTableKey);
20810
20810
  const firstKey = typeTableKeys[0];
20811
- const isNamed = (firstKey === null || firstKey === void 0 ? void 0 : firstKey.findDirectExpression(expressions_1.Field)) !== undefined;
20811
+ const isNamed = (firstKey === null || firstKey === void 0 ? void 0 : firstKey.findDirectExpression(expressions_1.Field)) !== undefined
20812
+ && ((_b = firstKey === null || firstKey === void 0 ? void 0 : firstKey.findDirectExpression(expressions_1.Field)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase()) !== "PRIMARY_KEY";
20812
20813
  const primaryKey = {
20813
20814
  name: "primary_key",
20814
20815
  type: type || basic_1.TableAccessType.standard,
@@ -20827,7 +20828,7 @@ class BasicTypes {
20827
20828
  const secondaryKeys = [];
20828
20829
  for (let i = start; i < typeTableKeys.length; i++) {
20829
20830
  const row = typeTableKeys[i];
20830
- const name = (_b = row.findDirectExpression(expressions_1.Field)) === null || _b === void 0 ? void 0 : _b.concatTokens();
20831
+ const name = (_c = row.findDirectExpression(expressions_1.Field)) === null || _c === void 0 ? void 0 : _c.concatTokens();
20831
20832
  if (name === undefined) {
20832
20833
  continue;
20833
20834
  }
@@ -20923,7 +20924,7 @@ class BasicTypes {
20923
20924
  else if (typename && (text.startsWith("TYPE TABLE FOR CREATE ")
20924
20925
  || text.startsWith("TYPE TABLE FOR UPDATE "))) {
20925
20926
  const name = typename.concatTokens();
20926
- const type = (_c = this.scope.getDDIC().lookupDDLS(name)) === null || _c === void 0 ? void 0 : _c.type;
20927
+ const type = (_d = this.scope.getDDIC().lookupDDLS(name)) === null || _d === void 0 ? void 0 : _d.type;
20927
20928
  if (type) {
20928
20929
  return new Types.TableType(new basic_1.VoidType("RapTodo"), options);
20929
20930
  }
@@ -46250,7 +46251,7 @@ class Registry {
46250
46251
  }
46251
46252
  static abaplintVersion() {
46252
46253
  // magic, see build script "version.sh"
46253
- return "2.97.0";
46254
+ return "2.97.4";
46254
46255
  }
46255
46256
  getDDICReferences() {
46256
46257
  return this.references;
@@ -63083,7 +63084,7 @@ class SQLEscapeHostVariables extends _abap_rule_1.ABAPRule {
63083
63084
  || s.get() instanceof Statements.SelectLoop
63084
63085
  || s.get() instanceof Statements.InsertDatabase
63085
63086
  || s.get() instanceof Statements.DeleteDatabase) {
63086
- for (const o of s.findAllExpressions(Expressions.SQLSource)) {
63087
+ for (const o of s.findAllExpressionsMulti([Expressions.SQLSource, Expressions.SQLSourceSimple])) {
63087
63088
  const first = o.getFirstChild();
63088
63089
  if (((first === null || first === void 0 ? void 0 : first.get()) instanceof Expressions.Source && first.getChildren()[0].get() instanceof Expressions.FieldChain)
63089
63090
  || ((first === null || first === void 0 ? void 0 : first.get()) instanceof Expressions.SimpleSource3 && first.getChildren()[0].get() instanceof Expressions.FieldChain)) {
@@ -63309,6 +63310,7 @@ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@ab
63309
63310
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
63310
63311
  const version_1 = __webpack_require__(/*! ../version */ "./node_modules/@abaplint/core/build/src/version.js");
63311
63312
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
63313
+ const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
63312
63314
  class StrictSQLConf extends _basic_rule_config_1.BasicRuleConfig {
63313
63315
  }
63314
63316
  exports.StrictSQLConf = StrictSQLConf;
@@ -63326,8 +63328,10 @@ class StrictSQL extends _abap_rule_1.ABAPRule {
63326
63328
 
63327
63329
  https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abenopensql_strict_mode_750.htm
63328
63330
 
63329
- Also see separate rule sql_escape_host_variables`,
63330
- tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Syntax],
63331
+ Also see separate rule sql_escape_host_variables
63332
+
63333
+ Activates from v750 and up`,
63334
+ tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Syntax, _irule_1.RuleTag.Quickfix],
63331
63335
  };
63332
63336
  }
63333
63337
  getConfig() {
@@ -63342,7 +63346,7 @@ Also see separate rule sql_escape_host_variables`,
63342
63346
  if (type === "INTF" || type === "TYPE") {
63343
63347
  return [];
63344
63348
  }
63345
- if (this.reg.getConfig().getVersion() < version_1.Version.v740sp02
63349
+ if (this.reg.getConfig().getVersion() < version_1.Version.v750
63346
63350
  && this.reg.getConfig().getVersion() !== version_1.Version.Cloud) {
63347
63351
  return [];
63348
63352
  }
@@ -63351,16 +63355,24 @@ Also see separate rule sql_escape_host_variables`,
63351
63355
  || s.get() instanceof Statements.SelectLoop) {
63352
63356
  const expr = s.findDirectExpression(Expressions.Select);
63353
63357
  const where = expr === null || expr === void 0 ? void 0 : expr.findDirectExpression(Expressions.SQLCond);
63358
+ const order = expr === null || expr === void 0 ? void 0 : expr.findDirectExpression(Expressions.SQLOrderBy);
63354
63359
  const into = (expr === null || expr === void 0 ? void 0 : expr.findDirectExpression(Expressions.SQLIntoStructure))
63355
63360
  || (expr === null || expr === void 0 ? void 0 : expr.findDirectExpression(Expressions.SQLIntoTable));
63356
63361
  if (into === undefined || where === undefined) {
63357
63362
  continue;
63358
63363
  }
63359
- if (where.getFirstToken().getStart().isBefore(into.getFirstToken().getStart())) {
63364
+ else if (where.getFirstToken().getStart().isBefore(into.getFirstToken().getStart())) {
63360
63365
  continue;
63361
63366
  }
63367
+ const fix1 = edit_helper_1.EditHelper.deleteRange(file, into.getFirstToken().getStart(), into.getLastToken().getEnd());
63368
+ let last = where.getLastToken();
63369
+ if (order && order.getLastToken().getEnd().isAfter(last.getEnd())) {
63370
+ last = order.getLastToken();
63371
+ }
63372
+ const fix2 = edit_helper_1.EditHelper.insertAt(file, last.getEnd(), " " + into.concatTokens());
63373
+ const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
63362
63374
  const message = "INTO/APPENDING must be last in strict SQL";
63363
- const issue = issue_1.Issue.atToken(file, s.getFirstToken(), message, this.getMetadata().key, this.conf.severity);
63375
+ const issue = issue_1.Issue.atToken(file, s.getFirstToken(), message, this.getMetadata().key, this.conf.severity, fix);
63364
63376
  issues.push(issue);
63365
63377
  break;
63366
63378
  }
@@ -68836,17 +68848,24 @@ class MethodSourceTranspiler {
68836
68848
  }
68837
68849
  else if (child.get() instanceof core_1.Expressions.Dynamic && (nextChild === null || nextChild === void 0 ? void 0 : nextChild.concatTokens()) === "=>") {
68838
68850
  const second = child.getChildren()[1];
68839
- const lookupException = traversal.lookupClassOrInterface("'CX_SY_DYN_CALL_ILLEGAL_CLASS'", child.getFirstToken(), true);
68851
+ const illegalClass = traversal.lookupClassOrInterface("'CX_SY_DYN_CALL_ILLEGAL_CLASS'", child.getFirstToken(), true);
68852
+ const illegalMethod = traversal.lookupClassOrInterface("'CX_SY_DYN_CALL_ILLEGAL_METHOD'", child.getFirstToken(), true);
68840
68853
  if (second.get() instanceof core_1.Expressions.FieldChain && second instanceof core_1.Nodes.ExpressionNode) {
68841
68854
  const t = new _1.FieldChainTranspiler(true).transpile(second, traversal).getCode();
68842
68855
  call = traversal.lookupClassOrInterface(t, child.getFirstToken(), true);
68843
- ret.appendString(`if (${call} === undefined && ${lookupException} === undefined) { throw "CX_SY_DYN_CALL_ILLEGAL_CLASS not found"; }\n`);
68844
- ret.appendString(`if (${call} === undefined) { throw new ${lookupException}(); }\n`);
68856
+ ret.appendString(`if (${call} === undefined && ${illegalClass} === undefined) { throw "CX_SY_DYN_CALL_ILLEGAL_CLASS not found"; }\n`);
68857
+ ret.appendString(`if (${call} === undefined) { throw new ${illegalClass}(); }\n`);
68845
68858
  }
68846
68859
  else if (second.get() instanceof core_1.Expressions.Constant) {
68847
68860
  call = traversal.lookupClassOrInterface(second.getFirstToken().getStr(), child.getFirstToken(), true);
68848
- ret.appendString(`if (${call} === undefined && ${lookupException} === undefined) { throw "CX_SY_DYN_CALL_ILLEGAL_CLASS not found"; }\n`);
68849
- ret.appendString(`if (${call} === undefined) { throw new ${lookupException}(); }\n`);
68861
+ ret.appendString(`if (${call} === undefined && ${illegalClass} === undefined) { throw "CX_SY_DYN_CALL_ILLEGAL_CLASS not found"; }\n`);
68862
+ ret.appendString(`if (${call} === undefined) { throw new ${illegalClass}(); }\n`);
68863
+ const name = children[i + 2];
68864
+ if (name.get() instanceof core_1.Expressions.AttributeName) {
68865
+ const suffix = "." + name.concatTokens().toLowerCase();
68866
+ ret.appendString(`if (${call + suffix} === undefined && ${illegalMethod} === undefined) { throw "CX_SY_DYN_CALL_ILLEGAL_METHOD not found"; }\n`);
68867
+ ret.appendString(`if (${call + suffix} === undefined) { throw new ${illegalMethod}(); }\n`);
68868
+ }
68850
68869
  }
68851
68870
  else {
68852
68871
  ret.appendString("MethodSourceTranspiler-Unexpected");
@@ -77668,6 +77687,7 @@ class Traversal {
77668
77687
  return undefined;
77669
77688
  }
77670
77689
  buildConstructorContents(scope, def) {
77690
+ var _a, _b, _c;
77671
77691
  let ret = "";
77672
77692
  if (def.getSuperClass() !== undefined
77673
77693
  && def.getMethodDefinitions().getByName("CONSTRUCTOR") === undefined) {
@@ -77676,7 +77696,7 @@ class Traversal {
77676
77696
  const cName = Traversal.escapeNamespace(def.getName().toLowerCase());
77677
77697
  ret += "this.me = new abap.types.ABAPObject();\n";
77678
77698
  ret += "this.me.set(this);\n";
77679
- for (const a of def.getAttributes().getAll()) {
77699
+ for (const a of ((_a = def.getAttributes()) === null || _a === void 0 ? void 0 : _a.getAll()) || []) {
77680
77700
  if (a.getMeta().includes("static" /* abaplint.IdentifierMeta.Static */) === true) {
77681
77701
  continue;
77682
77702
  }
@@ -77689,11 +77709,11 @@ class Traversal {
77689
77709
  ret += this.dataFromInterfaces(i.name, scope);
77690
77710
  }
77691
77711
  // handle aliases after initialization of carrier variables
77692
- for (const a of def.getAliases().getAll()) {
77712
+ for (const a of ((_b = def.getAliases()) === null || _b === void 0 ? void 0 : _b.getAll()) || []) {
77693
77713
  ret += "this." + a.getName().toLowerCase() + " = this." + Traversal.escapeNamespace(a.getComponent().replace("~", "$").toLowerCase()) + ";\n";
77694
77714
  }
77695
77715
  // constants can be accessed both statically and via reference
77696
- for (const c of def.getAttributes().getConstants()) {
77716
+ for (const c of ((_c = def.getAttributes()) === null || _c === void 0 ? void 0 : _c.getConstants()) || []) {
77697
77717
  ret += "this." + Traversal.escapeNamespace(c.getName().toLowerCase()) + " = " + cName + "." + Traversal.escapeNamespace(c.getName().toLowerCase()) + ";\n";
77698
77718
  }
77699
77719
  return ret;
@@ -91344,7 +91364,7 @@ function loadLib(config) {
91344
91364
  count++;
91345
91365
  }
91346
91366
  }
91347
- console.log(count + " files added from lib");
91367
+ console.log("\t" + count + " files added from lib");
91348
91368
  if (cleanupFolder === true) {
91349
91369
  file_operations_1.FileOperations.deleteFolderRecursive(dir);
91350
91370
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.5.73",
3
+ "version": "2.5.75",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "bin": {
6
6
  "abap_transpile": "./abap_transpile"
@@ -25,12 +25,12 @@
25
25
  "author": "abaplint",
26
26
  "license": "MIT",
27
27
  "devDependencies": {
28
- "@abaplint/transpiler": "^2.5.73",
28
+ "@abaplint/transpiler": "^2.5.75",
29
29
  "@types/glob": "^7.2.0",
30
30
  "glob": "=7.2.0",
31
31
  "@types/progress": "^2.0.5",
32
32
  "@types/node": "^18.15.11",
33
- "@abaplint/core": "^2.97.0",
33
+ "@abaplint/core": "^2.97.4",
34
34
  "progress": "^2.0.3",
35
35
  "webpack": "^5.77.0",
36
36
  "webpack-cli": "^5.0.1",