@abaplint/transpiler-cli 2.5.74 → 2.5.76

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 +32 -14
  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");
@@ -46251,7 +46251,7 @@ class Registry {
46251
46251
  }
46252
46252
  static abaplintVersion() {
46253
46253
  // magic, see build script "version.sh"
46254
- return "2.97.2";
46254
+ return "2.97.4";
46255
46255
  }
46256
46256
  getDDICReferences() {
46257
46257
  return this.references;
@@ -63084,7 +63084,7 @@ class SQLEscapeHostVariables extends _abap_rule_1.ABAPRule {
63084
63084
  || s.get() instanceof Statements.SelectLoop
63085
63085
  || s.get() instanceof Statements.InsertDatabase
63086
63086
  || s.get() instanceof Statements.DeleteDatabase) {
63087
- for (const o of s.findAllExpressions(Expressions.SQLSource)) {
63087
+ for (const o of s.findAllExpressionsMulti([Expressions.SQLSource, Expressions.SQLSourceSimple])) {
63088
63088
  const first = o.getFirstChild();
63089
63089
  if (((first === null || first === void 0 ? void 0 : first.get()) instanceof Expressions.Source && first.getChildren()[0].get() instanceof Expressions.FieldChain)
63090
63090
  || ((first === null || first === void 0 ? void 0 : first.get()) instanceof Expressions.SimpleSource3 && first.getChildren()[0].get() instanceof Expressions.FieldChain)) {
@@ -63310,6 +63310,7 @@ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@ab
63310
63310
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
63311
63311
  const version_1 = __webpack_require__(/*! ../version */ "./node_modules/@abaplint/core/build/src/version.js");
63312
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");
63313
63314
  class StrictSQLConf extends _basic_rule_config_1.BasicRuleConfig {
63314
63315
  }
63315
63316
  exports.StrictSQLConf = StrictSQLConf;
@@ -63327,8 +63328,10 @@ class StrictSQL extends _abap_rule_1.ABAPRule {
63327
63328
 
63328
63329
  https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abenopensql_strict_mode_750.htm
63329
63330
 
63330
- Also see separate rule sql_escape_host_variables`,
63331
- 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],
63332
63335
  };
63333
63336
  }
63334
63337
  getConfig() {
@@ -63343,7 +63346,7 @@ Also see separate rule sql_escape_host_variables`,
63343
63346
  if (type === "INTF" || type === "TYPE") {
63344
63347
  return [];
63345
63348
  }
63346
- if (this.reg.getConfig().getVersion() < version_1.Version.v740sp02
63349
+ if (this.reg.getConfig().getVersion() < version_1.Version.v750
63347
63350
  && this.reg.getConfig().getVersion() !== version_1.Version.Cloud) {
63348
63351
  return [];
63349
63352
  }
@@ -63352,16 +63355,24 @@ Also see separate rule sql_escape_host_variables`,
63352
63355
  || s.get() instanceof Statements.SelectLoop) {
63353
63356
  const expr = s.findDirectExpression(Expressions.Select);
63354
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);
63355
63359
  const into = (expr === null || expr === void 0 ? void 0 : expr.findDirectExpression(Expressions.SQLIntoStructure))
63356
63360
  || (expr === null || expr === void 0 ? void 0 : expr.findDirectExpression(Expressions.SQLIntoTable));
63357
63361
  if (into === undefined || where === undefined) {
63358
63362
  continue;
63359
63363
  }
63360
- if (where.getFirstToken().getStart().isBefore(into.getFirstToken().getStart())) {
63364
+ else if (where.getFirstToken().getStart().isBefore(into.getFirstToken().getStart())) {
63361
63365
  continue;
63362
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);
63363
63374
  const message = "INTO/APPENDING must be last in strict SQL";
63364
- 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);
63365
63376
  issues.push(issue);
63366
63377
  break;
63367
63378
  }
@@ -68837,17 +68848,24 @@ class MethodSourceTranspiler {
68837
68848
  }
68838
68849
  else if (child.get() instanceof core_1.Expressions.Dynamic && (nextChild === null || nextChild === void 0 ? void 0 : nextChild.concatTokens()) === "=>") {
68839
68850
  const second = child.getChildren()[1];
68840
- 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);
68841
68853
  if (second.get() instanceof core_1.Expressions.FieldChain && second instanceof core_1.Nodes.ExpressionNode) {
68842
68854
  const t = new _1.FieldChainTranspiler(true).transpile(second, traversal).getCode();
68843
68855
  call = traversal.lookupClassOrInterface(t, child.getFirstToken(), true);
68844
- ret.appendString(`if (${call} === undefined && ${lookupException} === undefined) { throw "CX_SY_DYN_CALL_ILLEGAL_CLASS not found"; }\n`);
68845
- 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`);
68846
68858
  }
68847
68859
  else if (second.get() instanceof core_1.Expressions.Constant) {
68848
68860
  call = traversal.lookupClassOrInterface(second.getFirstToken().getStr(), child.getFirstToken(), true);
68849
- ret.appendString(`if (${call} === undefined && ${lookupException} === undefined) { throw "CX_SY_DYN_CALL_ILLEGAL_CLASS not found"; }\n`);
68850
- 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
+ }
68851
68869
  }
68852
68870
  else {
68853
68871
  ret.appendString("MethodSourceTranspiler-Unexpected");
@@ -91346,7 +91364,7 @@ function loadLib(config) {
91346
91364
  count++;
91347
91365
  }
91348
91366
  }
91349
- console.log(count + " files added from lib");
91367
+ console.log("\t" + count + " files added from lib");
91350
91368
  if (cleanupFolder === true) {
91351
91369
  file_operations_1.FileOperations.deleteFolderRecursive(dir);
91352
91370
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.5.74",
3
+ "version": "2.5.76",
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.74",
28
+ "@abaplint/transpiler": "^2.5.76",
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.2",
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",