@abaplint/transpiler-cli 2.5.5 → 2.5.7

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 +53 -19
  2. package/package.json +3 -3
package/build/bundle.js CHANGED
@@ -4391,7 +4391,8 @@ class InlineData extends combi_1.Expression {
4391
4391
  const right = (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.ParenRightW), (0, combi_1.tok)(tokens_1.ParenRight));
4392
4392
  const left = (0, combi_1.tok)(tokens_1.ParenLeft);
4393
4393
  const data = (0, combi_1.seq)("DATA", left, _1.TargetField, right);
4394
- return (0, combi_1.ver)(version_1.Version.v740sp02, data);
4394
+ const final = (0, combi_1.seq)("FINAL", left, _1.TargetField, right);
4395
+ return (0, combi_1.altPrio)((0, combi_1.ver)(version_1.Version.v740sp02, data), (0, combi_1.ver)(version_1.Version.v757, final));
4395
4396
  }
4396
4397
  }
4397
4398
  exports.InlineData = InlineData;
@@ -11700,7 +11701,6 @@ exports.Import = void 0;
11700
11701
  const combi_1 = __webpack_require__(/*! ../combi */ "./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js");
11701
11702
  const tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js");
11702
11703
  const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
11703
- const version_1 = __webpack_require__(/*! ../../../version */ "./node_modules/@abaplint/core/build/src/version.js");
11704
11704
  class Import {
11705
11705
  getMatcher() {
11706
11706
  const dto = (0, combi_1.seq)("TO", expressions_1.Target);
@@ -11719,7 +11719,7 @@ class Import {
11719
11719
  const target = (0, combi_1.alt)(toeq, to, expressions_1.Dynamic, (0, combi_1.plus)(expressions_1.Target));
11720
11720
  const options = (0, combi_1.per)("ACCEPTING PADDING", "IGNORING CONVERSION ERRORS", "IN CHAR-TO-HEX MODE", "IGNORING STRUCTURE BOUNDARIES", "ACCEPTING TRUNCATION", (0, combi_1.seq)("REPLACEMENT CHARACTER", expressions_1.Source), (0, combi_1.seq)("CODE PAGE INTO", expressions_1.Source), (0, combi_1.seq)("ENDIAN INTO", expressions_1.Source));
11721
11721
  const ret = (0, combi_1.seq)("IMPORT", target, "FROM", source, (0, combi_1.opt)(options));
11722
- return (0, combi_1.verNot)(version_1.Version.Cloud, ret);
11722
+ return ret;
11723
11723
  }
11724
11724
  }
11725
11725
  exports.Import = Import;
@@ -21591,7 +21591,7 @@ class ComponentCompare {
21591
21591
  throw new Error("ComponentCompare, source not structured");
21592
21592
  }
21593
21593
  if (type.getComponentByName(fieldName) === undefined) {
21594
- throw new Error("Component " + fieldName + " not part of structure");
21594
+ throw new Error("Component \"" + fieldName + "\" not part of structure");
21595
21595
  }
21596
21596
  // todo, check type compatibility
21597
21597
  }
@@ -46037,7 +46037,7 @@ class Registry {
46037
46037
  }
46038
46038
  static abaplintVersion() {
46039
46039
  // magic, see build script "version.sh"
46040
- return "2.95.24";
46040
+ return "2.95.25";
46041
46041
  }
46042
46042
  getDDICReferences() {
46043
46043
  return this.references;
@@ -63413,6 +63413,7 @@ class UncaughtException extends _abap_rule_1.ABAPRule {
63413
63413
  if (stru === undefined) {
63414
63414
  return [];
63415
63415
  }
63416
+ this.findLocalExceptions(obj);
63416
63417
  this.syntax = new syntax_1.SyntaxLogic(this.reg, obj).run();
63417
63418
  if (this.syntax.issues.length > 0) {
63418
63419
  return [];
@@ -63535,7 +63536,6 @@ class UncaughtException extends _abap_rule_1.ABAPRule {
63535
63536
  def.getRaising().forEach(r => { var _a; return (_a = this.sinked) === null || _a === void 0 ? void 0 : _a.push(r); });
63536
63537
  }
63537
63538
  isSinked(name) {
63538
- // todo: ignore dynamic and no_check exceptions
63539
63539
  if (this.sinked === undefined || name === undefined) {
63540
63540
  return true;
63541
63541
  }
@@ -63543,9 +63543,13 @@ class UncaughtException extends _abap_rule_1.ABAPRule {
63543
63543
  if (sup === "CX_DYNAMIC_CHECK" || sup === "CX_NO_CHECK") {
63544
63544
  return true;
63545
63545
  }
63546
- // todo, check local class hierarchy
63546
+ const lsup = this.localExceptions[name.toUpperCase()];
63547
+ if (lsup === "CX_DYNAMIC_CHECK" || lsup === "CX_NO_CHECK") {
63548
+ return true;
63549
+ }
63547
63550
  return this.sinked.some(a => a.toUpperCase() === name.toUpperCase())
63548
- || (sup !== undefined && this.isSinked(sup) === true);
63551
+ || (sup !== undefined && this.isSinked(sup) === true)
63552
+ || (lsup !== undefined && this.isSinked(lsup) === true);
63549
63553
  }
63550
63554
  findGlobalExceptions() {
63551
63555
  var _a, _b;
@@ -63562,6 +63566,17 @@ class UncaughtException extends _abap_rule_1.ABAPRule {
63562
63566
  this.globalExceptions[o.getName().toUpperCase()] = (_b = def.superClassName) === null || _b === void 0 ? void 0 : _b.toUpperCase();
63563
63567
  }
63564
63568
  }
63569
+ findLocalExceptions(obj) {
63570
+ var _a;
63571
+ this.localExceptions = {};
63572
+ for (const file of obj.getABAPFiles()) {
63573
+ for (const def of file.getInfo().listClassDefinitions()) {
63574
+ if (def.isLocal === true && def.superClassName !== undefined) {
63575
+ this.localExceptions[def.name.toUpperCase()] = (_a = def.superClassName) === null || _a === void 0 ? void 0 : _a.toUpperCase();
63576
+ }
63577
+ }
63578
+ }
63579
+ }
63565
63580
  }
63566
63581
  exports.UncaughtException = UncaughtException;
63567
63582
  //# sourceMappingURL=uncaught_exception.js.map
@@ -69237,7 +69252,7 @@ class HandleABAP {
69237
69252
  this.options = options;
69238
69253
  }
69239
69254
  runObject(obj, reg) {
69240
- var _a, _b, _c;
69255
+ var _a, _b;
69241
69256
  let ret = [];
69242
69257
  if (obj instanceof abaplint.Objects.Program && obj.isInclude() === true) {
69243
69258
  // includes are only compiled along with the programs where its used?
@@ -69250,7 +69265,7 @@ class HandleABAP {
69250
69265
  chunk.appendString("// " + file.getFilename() + "\n");
69251
69266
  }
69252
69267
  const rearranged = new rearranger_1.Rearranger().run(obj.getType(), file.getStructure());
69253
- const contents = new traversal_1.Traversal(spaghetti, file, obj, reg, ((_b = this.options) === null || _b === void 0 ? void 0 : _b.unknownTypes) === "runtimeError").traverse(rearranged);
69268
+ const contents = new traversal_1.Traversal(spaghetti, file, obj, reg, this.options).traverse(rearranged);
69254
69269
  chunk.appendChunk(contents);
69255
69270
  chunk.stripLastNewline();
69256
69271
  chunk.runIndentationLogic();
@@ -69269,7 +69284,7 @@ class HandleABAP {
69269
69284
  ret.push(output);
69270
69285
  }
69271
69286
  ret = this.rearrangeClassLocals(obj, ret);
69272
- if (((_c = this.options) === null || _c === void 0 ? void 0 : _c.addCommonJS) === true) {
69287
+ if (((_b = this.options) === null || _b === void 0 ? void 0 : _b.addCommonJS) === true) {
69273
69288
  ret.map(output => output.chunk = this.addImportsAndExports(output));
69274
69289
  }
69275
69290
  return ret;
@@ -71380,6 +71395,7 @@ class CreateObjectTranspiler {
71380
71395
  return new chunk_1.Chunk(ret);
71381
71396
  }
71382
71397
  findClassName(node, traversal) {
71398
+ var _a;
71383
71399
  const c = node.findDirectExpression(abaplint.Expressions.ClassName);
71384
71400
  if (c) {
71385
71401
  return c.concatTokens();
@@ -71400,7 +71416,7 @@ class CreateObjectTranspiler {
71400
71416
  return "object";
71401
71417
  }
71402
71418
  else if (!(type instanceof abaplint.BasicTypes.ObjectReferenceType)) {
71403
- if (traversal.runtimeTypeError === false) {
71419
+ if (((_a = traversal.options) === null || _a === void 0 ? void 0 : _a.unknownTypes) !== "runtimeError") {
71404
71420
  throw new Error(`CreateObjectTranspiler, target variable "${target === null || target === void 0 ? void 0 : target.concatTokens()}" not a object reference`);
71405
71421
  }
71406
71422
  else {
@@ -73795,9 +73811,24 @@ exports.ReadLineTranspiler = ReadLineTranspiler;
73795
73811
  Object.defineProperty(exports, "__esModule", ({ value: true }));
73796
73812
  exports.ReadReportTranspiler = void 0;
73797
73813
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
73814
+ const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/@abaplint/transpiler/build/src/expressions/index.js");
73798
73815
  class ReadReportTranspiler {
73799
- transpile(_node, _traversal) {
73800
- return new chunk_1.Chunk(`throw new Error("ReadReport, transpiler todo");`);
73816
+ transpile(node, traversal) {
73817
+ const reportNode = node.findExpressionAfterToken("REPORT");
73818
+ const reportChunk = new expressions_1.SourceTranspiler().transpile(reportNode, traversal);
73819
+ const options = [];
73820
+ const intoNode = node.findExpressionAfterToken("INTO");
73821
+ if (intoNode) {
73822
+ options.push("into: " + new expressions_1.TargetTranspiler().transpile(intoNode, traversal).getCode());
73823
+ }
73824
+ const stateNode = node.findExpressionAfterToken("STATE");
73825
+ if (stateNode) {
73826
+ options.push("state: " + new expressions_1.SourceTranspiler().transpile(stateNode, traversal).getCode());
73827
+ }
73828
+ return new chunk_1.Chunk().appendString(`abap.statements.readReport(`)
73829
+ .appendChunk(reportChunk)
73830
+ .appendString(", {" + options.join(",") + "}")
73831
+ .appendString(");");
73801
73832
  }
73802
73833
  }
73803
73834
  exports.ReadReportTranspiler = ReadReportTranspiler;
@@ -75717,7 +75748,7 @@ class FunctionModuleTranspiler {
75717
75748
  }
75718
75749
  //////////////////////
75719
75750
  findSignature(traversal, name, node) {
75720
- var _a;
75751
+ var _a, _b, _c;
75721
75752
  const group = traversal.getCurrentObject();
75722
75753
  if (group === undefined) {
75723
75754
  throw "FunctionModuleTranspilerGroupNotFound";
@@ -75738,10 +75769,13 @@ class FunctionModuleTranspiler {
75738
75769
  direction = "importing";
75739
75770
  }
75740
75771
  // note: all directions are optional
75741
- const name = p.name.toLowerCase();
75772
+ let name = p.name.toLowerCase();
75773
+ if ((_b = (_a = traversal.options) === null || _a === void 0 ? void 0 : _a.keywords) === null || _b === void 0 ? void 0 : _b.some(a => a === name)) {
75774
+ name += "_";
75775
+ }
75742
75776
  ret += `let ${name} = INPUT.${direction}?.${name};\n`;
75743
75777
  if (direction === "exporting" || direction === "importing" || direction === "changing") {
75744
- const type = (_a = scope === null || scope === void 0 ? void 0 : scope.findVariable(name)) === null || _a === void 0 ? void 0 : _a.getType();
75778
+ const type = (_c = scope === null || scope === void 0 ? void 0 : scope.findVariable(name)) === null || _c === void 0 ? void 0 : _c.getType();
75745
75779
  if (type !== undefined) {
75746
75780
  // todo, set DEFAULT value
75747
75781
  // todo, check for OPTIONALness and raise exceptions and stuff
@@ -76294,13 +76328,13 @@ const transpile_types_1 = __webpack_require__(/*! ./transpile_types */ "./node_m
76294
76328
  const chunk_1 = __webpack_require__(/*! ./chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
76295
76329
  const expressions_1 = __webpack_require__(/*! ./expressions */ "./node_modules/@abaplint/transpiler/build/src/expressions/index.js");
76296
76330
  class Traversal {
76297
- constructor(spaghetti, file, obj, reg, runtimeTypeError = false) {
76331
+ constructor(spaghetti, file, obj, reg, options) {
76298
76332
  this.scopeCache = undefined;
76299
76333
  this.spaghetti = spaghetti;
76300
76334
  this.file = file;
76301
76335
  this.obj = obj;
76302
76336
  this.reg = reg;
76303
- this.runtimeTypeError = runtimeTypeError;
76337
+ this.options = options;
76304
76338
  }
76305
76339
  static escapeNamespace(name) {
76306
76340
  return name === null || name === void 0 ? void 0 : name.replace(/\//g, "$");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.5.5",
3
+ "version": "2.5.7",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "bin": {
6
6
  "abap_transpile": "./abap_transpile"
@@ -25,11 +25,11 @@
25
25
  "author": "abaplint",
26
26
  "license": "MIT",
27
27
  "devDependencies": {
28
- "@abaplint/transpiler": "^2.5.5",
28
+ "@abaplint/transpiler": "^2.5.7",
29
29
  "@types/glob": "^7.2.0",
30
30
  "glob": "=7.2.0",
31
31
  "@types/progress": "^2.0.5",
32
- "@abaplint/core": "^2.95.24",
32
+ "@abaplint/core": "^2.95.25",
33
33
  "progress": "^2.0.3",
34
34
  "webpack": "^5.75.0",
35
35
  "webpack-cli": "^5.0.1",