@abaplint/transpiler-cli 2.13.93 → 2.13.94

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 +90 -11
  2. package/package.json +3 -3
package/build/bundle.js CHANGED
@@ -6907,7 +6907,9 @@ const combi_1 = __webpack_require__(/*! ../combi */ "./node_modules/@abaplint/co
6907
6907
  const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
6908
6908
  class MethodDefExceptions extends combi_1.Expression {
6909
6909
  getRunnable() {
6910
- const exceptions = (0, combi_1.seq)("EXCEPTIONS", (0, combi_1.plusPrio)(_1.NamespaceSimpleName));
6910
+ // parameter section keywords cannot be exception names
6911
+ const name = (0, combi_1.seq)((0, combi_1.stopBefore1)("IMPORTING", "EXPORTING", "CHANGING", "RETURNING", "RAISING", "EXCEPTIONS"), _1.NamespaceSimpleName);
6912
+ const exceptions = (0, combi_1.seq)("EXCEPTIONS", (0, combi_1.plusPrio)(name));
6911
6913
  return exceptions;
6912
6914
  }
6913
6915
  }
@@ -6979,7 +6981,9 @@ const class_name_1 = __webpack_require__(/*! ./class_name */ "./node_modules/@ab
6979
6981
  class MethodDefRaising extends combi_1.Expression {
6980
6982
  getRunnable() {
6981
6983
  const resumable = (0, combi_1.seq)("RESUMABLE", (0, combi_1.tok)(tokens_1.ParenLeft), class_name_1.ClassName, (0, combi_1.tok)(tokens_1.ParenRightW));
6982
- const raising = (0, combi_1.seq)("RAISING", (0, combi_1.plus)((0, combi_1.altPrio)(resumable, class_name_1.ClassName)));
6984
+ // parameter section keywords cannot be exception names
6985
+ const name = (0, combi_1.seq)((0, combi_1.stopBefore1)("IMPORTING", "EXPORTING", "CHANGING", "RETURNING", "RAISING", "EXCEPTIONS"), class_name_1.ClassName);
6986
+ const raising = (0, combi_1.seq)("RAISING", (0, combi_1.plus)((0, combi_1.altPrio)(resumable, name)));
6983
6987
  return raising;
6984
6988
  }
6985
6989
  }
@@ -17283,7 +17287,7 @@ class MethodDef {
17283
17287
  (0, combi_1.seq)("VALIDATE ON SAVE IMPORTING", expressions_1.MethodParamName, "FOR", expressions_1.TypeName), (0, combi_1.seq)("MODIFY", (0, combi_1.opt)("IMPORTING"), (0, combi_1.plus)((0, combi_1.seq)(expressions_1.MethodParamName, modify))), (0, combi_1.seq)("PRECHECK IMPORTING", expressions_1.MethodParamName, modify), (0, combi_1.seq)("DETERMINATION", expressions_1.TypeName, "IMPORTING", expressions_1.MethodParamName, "FOR", expressions_1.TypeName), (0, combi_1.seq)("VALIDATION", expressions_1.TypeName, "IMPORTING", expressions_1.MethodParamName, "FOR", expressions_1.TypeName), (0, combi_1.seq)("NUMBERING IMPORTING", expressions_1.MethodParamName, modify), (0, combi_1.seq)("READ IMPORTING", expressions_1.MethodParamName, (0, combi_1.altPrio)(forRead, forfunction)), (0, combi_1.seq)("FEATURES IMPORTING", expressions_1.MethodParamName, "REQUEST", expressions_1.NamespaceSimpleName, "FOR", expressions_1.NamespaceSimpleName, result), (0, combi_1.seq)("BEHAVIOR IMPORTING", expressions_1.MethodParamName, "FOR CREATE", expressions_1.TypeName, expressions_1.MethodParamName, "FOR UPDATE", expressions_1.TypeName, expressions_1.MethodParamName, "FOR DELETE", expressions_1.TypeName), (0, combi_1.seq)("BEHAVIOR IMPORTING", expressions_1.MethodParamName, "FOR READ", expressions_1.TypeName, result), (0, combi_1.seq)("BEHAVIOR IMPORTING", expressions_1.MethodParamName, "FOR UPDATE", expressions_1.TypeName), (0, combi_1.seq)((0, combi_1.alt)("BEHAVIOR", "LOCK"), "IMPORTING", expressions_1.MethodParamName, "FOR LOCK", expressions_1.TypeName), (0, combi_1.seq)("DETERMINE", (0, combi_1.alt)("ON MODIFY", "ON SAVE"), "IMPORTING", expressions_1.MethodParamName, "FOR", expressions_1.TypeName), (0, combi_1.seq)("GLOBAL AUTHORIZATION IMPORTING REQUEST", expressions_1.MethodParamName, "FOR", expressions_1.TypeName, result), (0, combi_1.seq)("GLOBAL FEATURES IMPORTING REQUEST", expressions_1.MethodParamName, "FOR", expressions_1.TypeName, result), (0, combi_1.seq)((0, combi_1.seq)((0, combi_1.opt)("INSTANCE"), "AUTHORIZATION IMPORTING"), expressions_1.MethodParamName, "REQUEST", expressions_1.MethodParamName, "FOR", expressions_1.TypeName, result), (0, combi_1.seq)("INSTANCE FEATURES IMPORTING", expressions_1.MethodParamName, "REQUEST", expressions_1.MethodParamName, "FOR", expressions_1.TypeName, result));
17284
17288
  // todo, this is only from version something
17285
17289
  // AMDP OPTIONS clause blocked in KeyUser
17286
- const amdp = (0, combi_1.verNotLang)(version_1.LanguageVersion.KeyUser, (0, combi_1.seq)("AMDP OPTIONS", (0, combi_1.optPrio)("READ-ONLY"), "CDS SESSION CLIENT", (0, combi_1.alt)("CURRENT", "DEPENDENT"), (0, combi_1.optPrio)(expressions_1.MethodDefImporting), (0, combi_1.optPrio)(expressions_1.MethodDefExporting), (0, combi_1.optPrio)(expressions_1.MethodDefRaising)));
17290
+ const amdp = (0, combi_1.verNotLang)(version_1.LanguageVersion.KeyUser, (0, combi_1.seq)("AMDP OPTIONS", (0, combi_1.per)("READ-ONLY", (0, combi_1.seq)("CDS SESSION CLIENT", (0, combi_1.alt)("CURRENT", "DEPENDENT"))), (0, combi_1.optPrio)(expressions_1.MethodDefImporting), (0, combi_1.optPrio)(expressions_1.MethodDefExporting), (0, combi_1.optPrio)(expressions_1.MethodDefRaising)));
17287
17291
  // FOR DDL OBJECT / FOR TABLE FUNCTION / FOR SCALAR FUNCTION blocked in KeyUser
17288
17292
  const regular = (0, combi_1.seq)((0, combi_1.altPrio)("CLASS-METHODS", "METHODS"), expressions_1.MethodName, (0, combi_1.alt)((0, combi_1.seq)((0, combi_1.optPrio)(expressions_1.Abstract), (0, combi_1.optPrio)(def), expressions_1.EventHandler), parameters, testing, (0, combi_1.verNotLang)(version_1.LanguageVersion.KeyUser, (0, combi_1.seq)("FOR", behavior)), amdp, "NOT AT END OF MODE", (0, combi_1.optPrio)(expressions_1.Redefinition)));
17289
17293
  // RAP event handlers are instance methods; CLASS-METHODS is not allowed.
@@ -17314,7 +17318,8 @@ class MethodImplementation {
17314
17318
  const name = (0, combi_1.regex)(/[\w~]+/);
17315
17319
  const kernel = (0, combi_1.seq)("KERNEL MODULE", (0, combi_1.plus)(name), (0, combi_1.optPrio)((0, combi_1.altPrio)("FAIL", "IGNORE")));
17316
17320
  const using = (0, combi_1.seq)("USING", (0, combi_1.plus)(expressions_1.SimpleFieldChain));
17317
- const database = (0, combi_1.seq)("DATABASE", (0, combi_1.alt)("PROCEDURE", "FUNCTION", "GRAPH WORKSPACE"), "FOR HDB", expressions_1.Language, (0, combi_1.opt)("OPTIONS READ-ONLY"), (0, combi_1.opt)(using));
17321
+ const options = (0, combi_1.seq)("OPTIONS", (0, combi_1.per)("READ-ONLY", "SUPPRESS SYNTAX ERRORS", "DETERMINISTIC"));
17322
+ const database = (0, combi_1.seq)("DATABASE", (0, combi_1.alt)("PROCEDURE", "FUNCTION", "GRAPH WORKSPACE"), "FOR HDB", expressions_1.Language, (0, combi_1.opt)(options), (0, combi_1.opt)(using));
17318
17323
  // BY DATABASE and BY KERNEL both blocked in KeyUser
17319
17324
  const by = (0, combi_1.verNotLang)(version_1.LanguageVersion.KeyUser, (0, combi_1.seq)("BY", (0, combi_1.alt)(kernel, database)));
17320
17325
  return (0, combi_1.seq)("METHOD", expressions_1.MethodName, (0, combi_1.optPrio)(by));
@@ -25483,6 +25488,12 @@ class BuiltIn {
25483
25488
  }
25484
25489
  return this.buildDefinition(def, name);
25485
25490
  }
25491
+ static hasUnnamedArgument(name) {
25492
+ if (name === undefined) {
25493
+ return false;
25494
+ }
25495
+ return BuiltIn.unnamedArgument.has(name.toUpperCase());
25496
+ }
25486
25497
  static isPredicate(name) {
25487
25498
  if (name === undefined) {
25488
25499
  return undefined;
@@ -26584,6 +26595,12 @@ BuiltIn.methods = {
26584
26595
  return: basic_1.IntegerType.get(),
26585
26596
  },
26586
26597
  };
26598
+ // functions called with exactly one unnamed argument, all others take named arguments like "val"
26599
+ BuiltIn.unnamedArgument = new Set([
26600
+ "ABS", "ACOS", "ASIN", "ATAN", "BOOLC", "CEIL", "CHARLEN", "COS", "COSH", "DBMAXLEN", "EXP", "FLOOR",
26601
+ "FRAC", "LINES", "LOG", "LOG10", "NUMOFCHAR", "SIGN", "SIN", "SINH", "SQRT", "STRLEN", "TAN", "TANH",
26602
+ "TRUNC", "XSTRLEN"
26603
+ ]);
26587
26604
  //# sourceMappingURL=_builtin.js.map
26588
26605
 
26589
26606
  /***/ },
@@ -38637,17 +38654,54 @@ var __importStar = (this && this.__importStar) || (function () {
38637
38654
  })();
38638
38655
  Object.defineProperty(exports, "__esModule", ({ value: true }));
38639
38656
  exports.Case = void 0;
38657
+ exports.checkCaseOperand = checkCaseOperand;
38640
38658
  const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
38641
38659
  const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
38660
+ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
38661
+ const _builtin_1 = __webpack_require__(/*! ../_builtin */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js");
38662
+ const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js");
38663
+ const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
38664
+ const version_1 = __webpack_require__(/*! ../../../version */ "./node_modules/@abaplint/core/build/src/version.js");
38642
38665
  class Case {
38643
38666
  runSyntax(node, input) {
38644
38667
  // just recurse
38645
38668
  for (const s of node.findDirectExpressions(Expressions.Source)) {
38646
38669
  source_1.Source.runSyntax(s, input);
38670
+ checkCaseOperand(s, input);
38647
38671
  }
38648
38672
  }
38649
38673
  }
38650
38674
  exports.Case = Case;
38675
+ // Before 7.40 SP02 the operands of CASE and WHEN are enhanced functional operand positions: besides
38676
+ // data objects and functional methods, only built-in functions with exactly one unnamed argument are allowed
38677
+ function checkCaseOperand(source, input) {
38678
+ var _a, _b;
38679
+ if ((0, version_1.releaseAtLeast)(input.scope.getRelease(), version_1.Release.v740sp02)
38680
+ || input.scope.getLanguageVersion() === version_1.LanguageVersion.Cloud
38681
+ || input.scope.getOpenABAP()) {
38682
+ return;
38683
+ }
38684
+ const chain = source.findDirectExpression(Expressions.MethodCallChain);
38685
+ if (chain === undefined || source.getChildren().length !== 1 || chain.getChildren().length !== 1) {
38686
+ return;
38687
+ }
38688
+ const call = chain.findDirectExpression(Expressions.MethodCall);
38689
+ const nameToken = (_a = call === null || call === void 0 ? void 0 : call.findDirectExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
38690
+ const name = nameToken === null || nameToken === void 0 ? void 0 : nameToken.getStr();
38691
+ if (nameToken === undefined || _builtin_1.BuiltIn.searchBuiltin(name) === undefined || _builtin_1.BuiltIn.hasUnnamedArgument(name)) {
38692
+ return;
38693
+ }
38694
+ // a method of the enclosing class takes precedence over the built-in function
38695
+ const meType = (_b = input.scope.findVariable("me")) === null || _b === void 0 ? void 0 : _b.getType();
38696
+ if (meType instanceof basic_1.ObjectReferenceType) {
38697
+ const def = input.scope.findObjectDefinition(meType.getIdentifierName());
38698
+ if (new _object_oriented_1.ObjectOriented(input.scope).searchMethodName(def, name).method !== undefined) {
38699
+ return;
38700
+ }
38701
+ }
38702
+ const message = "Built-in function " + name + " not allowed as CASE/WHEN operand before v740sp02";
38703
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, nameToken, message));
38704
+ }
38651
38705
  //# sourceMappingURL=case.js.map
38652
38706
 
38653
38707
  /***/ },
@@ -40005,10 +40059,22 @@ const basic_types_1 = __webpack_require__(/*! ../basic_types */ "./node_modules/
40005
40059
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
40006
40060
  const _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ "./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js");
40007
40061
  const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
40062
+ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
40008
40063
  class CreateData {
40009
40064
  runSyntax(node, input) {
40065
+ const likeLineOf = node.concatTokens().toUpperCase().includes(" LIKE LINE OF ");
40010
40066
  for (const s of node.findDirectExpressions(Expressions.Source)) {
40011
- source_1.Source.runSyntax(s, input);
40067
+ const sourceType = source_1.Source.runSyntax(s, input);
40068
+ if (likeLineOf === true
40069
+ && sourceType !== undefined
40070
+ && !(sourceType instanceof basic_1.TableType)
40071
+ && !(sourceType instanceof basic_1.VoidType)
40072
+ && !(sourceType instanceof basic_1.UnknownType)
40073
+ && !(sourceType instanceof basic_1.AnyType)) {
40074
+ const message = `"${s.concatTokens()}" is not an internal table`;
40075
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
40076
+ return;
40077
+ }
40012
40078
  }
40013
40079
  for (const t of node.findDirectExpressions(Expressions.Target)) {
40014
40080
  target_1.Target.runSyntax(t, input);
@@ -40193,6 +40259,11 @@ class CreateObject {
40193
40259
  ooName = found.getVoided();
40194
40260
  }
40195
40261
  input.scope.addReference(t === null || t === void 0 ? void 0 : t.getFirstToken(), cdef, _reference_1.ReferenceType.ConstructorReference, input.filename, { ooName: ooName });
40262
+ if (type && type.get() instanceof Expressions.Dynamic) {
40263
+ // the class is only known at runtime, cdef is the static type of the target
40264
+ this.validateParameters(undefined, node, input);
40265
+ return;
40266
+ }
40196
40267
  if (cdef !== undefined) {
40197
40268
  const err = CreateObject.checkInstantiationAllowed(cdef, input);
40198
40269
  if (err) {
@@ -47704,11 +47775,15 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
47704
47775
  exports.When = void 0;
47705
47776
  const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
47706
47777
  const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
47778
+ const case_1 = __webpack_require__(/*! ./case */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/case.js");
47707
47779
  class When {
47708
47780
  runSyntax(node, input) {
47709
47781
  for (const s of node.findAllExpressions(Expressions.Source)) {
47710
47782
  source_1.Source.runSyntax(s, input);
47711
47783
  }
47784
+ for (const s of node.findDirectExpressions(Expressions.Source)) {
47785
+ (0, case_1.checkCaseOperand)(s, input);
47786
+ }
47712
47787
  }
47713
47788
  }
47714
47789
  exports.When = When;
@@ -71242,7 +71317,7 @@ class Registry {
71242
71317
  }
71243
71318
  static abaplintVersion() {
71244
71319
  // magic, see build script "version.js"
71245
- return "2.120.59";
71320
+ return "2.120.61";
71246
71321
  }
71247
71322
  getDDICReferences() {
71248
71323
  return this.ddicReferences;
@@ -71875,12 +71950,13 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#abap-doc-on
71875
71950
  return issues;
71876
71951
  }
71877
71952
  getAbapdoc(rows, pos) {
71953
+ var _a, _b, _c;
71878
71954
  let previousRow = pos.getRow() - 2;
71879
- let rowText = rows[previousRow].trim().toUpperCase();
71955
+ let rowText = ((_a = rows[previousRow]) !== null && _a !== void 0 ? _a : "").trim().toUpperCase();
71880
71956
  const text = [];
71881
71957
  if (rowText === "METHODS" || rowText === "CLASS-METHODS") {
71882
71958
  previousRow--;
71883
- rowText = rows[previousRow].trim().toUpperCase();
71959
+ rowText = ((_b = rows[previousRow]) !== null && _b !== void 0 ? _b : "").trim().toUpperCase();
71884
71960
  }
71885
71961
  text.push(rowText);
71886
71962
  //we need to push the first row despite if it is actually an abapdoc or not
@@ -71888,7 +71964,7 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#abap-doc-on
71888
71964
  if (rowText.trim().substring(0, 2) === "\"!") {
71889
71965
  while (previousRow >= 0) {
71890
71966
  previousRow--;
71891
- rowText = rows[previousRow].trim().toUpperCase();
71967
+ rowText = ((_c = rows[previousRow]) !== null && _c !== void 0 ? _c : "").trim().toUpperCase();
71892
71968
  if (rowText.trim().substring(0, 2) !== "\"!") {
71893
71969
  break;
71894
71970
  }
@@ -115665,11 +115741,14 @@ class DoTranspiler {
115665
115741
  transpile(node, traversal) {
115666
115742
  const found = node.findFirstExpression(abaplint.Expressions.Source);
115667
115743
  if (found) {
115668
- const source = new expressions_1.SourceTranspiler(true).transpile(found, traversal).getCode();
115744
+ // the count is converted to i, like any numeric expression position: an
115745
+ // f count read with get( ) gives its text 3,0000000000000000E+00, which
115746
+ // no loop counter compares with, and a p count of 2.4 means 2 passes
115747
+ const source = new expressions_1.SourceTranspiler(false).transpile(found, traversal).getCode();
115669
115748
  const idSource = unique_identifier_1.UniqueIdentifier.get();
115670
115749
  const id = unique_identifier_1.UniqueIdentifier.get();
115671
115750
  return new chunk_1.Chunk(`const ${this.syIndexBackup} = abap.builtin.sy.get().index.get();
115672
- const ${idSource} = ${source};
115751
+ const ${idSource} = new abap.types.Integer().set(${source}).get();
115673
115752
  for (let ${id} = 0; ${id} < ${idSource}; ${id}++) {
115674
115753
  abap.builtin.sy.get().index.set(${id} + 1);`);
115675
115754
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.13.93",
3
+ "version": "2.13.94",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -27,8 +27,8 @@
27
27
  "author": "abaplint",
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
- "@abaplint/core": "^2.120.59",
31
- "@abaplint/transpiler": "^2.13.93",
30
+ "@abaplint/core": "^2.120.61",
31
+ "@abaplint/transpiler": "^2.13.94",
32
32
  "@types/glob": "^9.0.0",
33
33
  "@types/node": "^26.6.2",
34
34
  "@types/progress": "^2.0.7",