@abaplint/cli 2.120.59 → 2.120.61

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 +85 -9
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -6355,7 +6355,9 @@ const combi_1 = __webpack_require__(/*! ../combi */ "../core/build/src/abap/2_st
6355
6355
  const _1 = __webpack_require__(/*! . */ "../core/build/src/abap/2_statements/expressions/index.js");
6356
6356
  class MethodDefExceptions extends combi_1.Expression {
6357
6357
  getRunnable() {
6358
- const exceptions = (0, combi_1.seq)("EXCEPTIONS", (0, combi_1.plusPrio)(_1.NamespaceSimpleName));
6358
+ // parameter section keywords cannot be exception names
6359
+ const name = (0, combi_1.seq)((0, combi_1.stopBefore1)("IMPORTING", "EXPORTING", "CHANGING", "RETURNING", "RAISING", "EXCEPTIONS"), _1.NamespaceSimpleName);
6360
+ const exceptions = (0, combi_1.seq)("EXCEPTIONS", (0, combi_1.plusPrio)(name));
6359
6361
  return exceptions;
6360
6362
  }
6361
6363
  }
@@ -6427,7 +6429,9 @@ const class_name_1 = __webpack_require__(/*! ./class_name */ "../core/build/src/
6427
6429
  class MethodDefRaising extends combi_1.Expression {
6428
6430
  getRunnable() {
6429
6431
  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));
6430
- const raising = (0, combi_1.seq)("RAISING", (0, combi_1.plus)((0, combi_1.altPrio)(resumable, class_name_1.ClassName)));
6432
+ // parameter section keywords cannot be exception names
6433
+ const name = (0, combi_1.seq)((0, combi_1.stopBefore1)("IMPORTING", "EXPORTING", "CHANGING", "RETURNING", "RAISING", "EXCEPTIONS"), class_name_1.ClassName);
6434
+ const raising = (0, combi_1.seq)("RAISING", (0, combi_1.plus)((0, combi_1.altPrio)(resumable, name)));
6431
6435
  return raising;
6432
6436
  }
6433
6437
  }
@@ -16731,7 +16735,7 @@ class MethodDef {
16731
16735
  (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));
16732
16736
  // todo, this is only from version something
16733
16737
  // AMDP OPTIONS clause blocked in KeyUser
16734
- 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)));
16738
+ 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)));
16735
16739
  // FOR DDL OBJECT / FOR TABLE FUNCTION / FOR SCALAR FUNCTION blocked in KeyUser
16736
16740
  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)));
16737
16741
  // RAP event handlers are instance methods; CLASS-METHODS is not allowed.
@@ -16762,7 +16766,8 @@ class MethodImplementation {
16762
16766
  const name = (0, combi_1.regex)(/[\w~]+/);
16763
16767
  const kernel = (0, combi_1.seq)("KERNEL MODULE", (0, combi_1.plus)(name), (0, combi_1.optPrio)((0, combi_1.altPrio)("FAIL", "IGNORE")));
16764
16768
  const using = (0, combi_1.seq)("USING", (0, combi_1.plus)(expressions_1.SimpleFieldChain));
16765
- 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));
16769
+ const options = (0, combi_1.seq)("OPTIONS", (0, combi_1.per)("READ-ONLY", "SUPPRESS SYNTAX ERRORS", "DETERMINISTIC"));
16770
+ 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));
16766
16771
  // BY DATABASE and BY KERNEL both blocked in KeyUser
16767
16772
  const by = (0, combi_1.verNotLang)(version_1.LanguageVersion.KeyUser, (0, combi_1.seq)("BY", (0, combi_1.alt)(kernel, database)));
16768
16773
  return (0, combi_1.seq)("METHOD", expressions_1.MethodName, (0, combi_1.optPrio)(by));
@@ -24931,6 +24936,12 @@ class BuiltIn {
24931
24936
  }
24932
24937
  return this.buildDefinition(def, name);
24933
24938
  }
24939
+ static hasUnnamedArgument(name) {
24940
+ if (name === undefined) {
24941
+ return false;
24942
+ }
24943
+ return BuiltIn.unnamedArgument.has(name.toUpperCase());
24944
+ }
24934
24945
  static isPredicate(name) {
24935
24946
  if (name === undefined) {
24936
24947
  return undefined;
@@ -26032,6 +26043,12 @@ BuiltIn.methods = {
26032
26043
  return: basic_1.IntegerType.get(),
26033
26044
  },
26034
26045
  };
26046
+ // functions called with exactly one unnamed argument, all others take named arguments like "val"
26047
+ BuiltIn.unnamedArgument = new Set([
26048
+ "ABS", "ACOS", "ASIN", "ATAN", "BOOLC", "CEIL", "CHARLEN", "COS", "COSH", "DBMAXLEN", "EXP", "FLOOR",
26049
+ "FRAC", "LINES", "LOG", "LOG10", "NUMOFCHAR", "SIGN", "SIN", "SINH", "SQRT", "STRLEN", "TAN", "TANH",
26050
+ "TRUNC", "XSTRLEN"
26051
+ ]);
26035
26052
  //# sourceMappingURL=_builtin.js.map
26036
26053
 
26037
26054
  /***/ },
@@ -38085,17 +38102,54 @@ var __importStar = (this && this.__importStar) || (function () {
38085
38102
  })();
38086
38103
  Object.defineProperty(exports, "__esModule", ({ value: true }));
38087
38104
  exports.Case = void 0;
38105
+ exports.checkCaseOperand = checkCaseOperand;
38088
38106
  const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
38089
38107
  const source_1 = __webpack_require__(/*! ../expressions/source */ "../core/build/src/abap/5_syntax/expressions/source.js");
38108
+ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
38109
+ const _builtin_1 = __webpack_require__(/*! ../_builtin */ "../core/build/src/abap/5_syntax/_builtin.js");
38110
+ const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "../core/build/src/abap/5_syntax/_object_oriented.js");
38111
+ const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
38112
+ const version_1 = __webpack_require__(/*! ../../../version */ "../core/build/src/version.js");
38090
38113
  class Case {
38091
38114
  runSyntax(node, input) {
38092
38115
  // just recurse
38093
38116
  for (const s of node.findDirectExpressions(Expressions.Source)) {
38094
38117
  source_1.Source.runSyntax(s, input);
38118
+ checkCaseOperand(s, input);
38095
38119
  }
38096
38120
  }
38097
38121
  }
38098
38122
  exports.Case = Case;
38123
+ // Before 7.40 SP02 the operands of CASE and WHEN are enhanced functional operand positions: besides
38124
+ // data objects and functional methods, only built-in functions with exactly one unnamed argument are allowed
38125
+ function checkCaseOperand(source, input) {
38126
+ var _a, _b;
38127
+ if ((0, version_1.releaseAtLeast)(input.scope.getRelease(), version_1.Release.v740sp02)
38128
+ || input.scope.getLanguageVersion() === version_1.LanguageVersion.Cloud
38129
+ || input.scope.getOpenABAP()) {
38130
+ return;
38131
+ }
38132
+ const chain = source.findDirectExpression(Expressions.MethodCallChain);
38133
+ if (chain === undefined || source.getChildren().length !== 1 || chain.getChildren().length !== 1) {
38134
+ return;
38135
+ }
38136
+ const call = chain.findDirectExpression(Expressions.MethodCall);
38137
+ const nameToken = (_a = call === null || call === void 0 ? void 0 : call.findDirectExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
38138
+ const name = nameToken === null || nameToken === void 0 ? void 0 : nameToken.getStr();
38139
+ if (nameToken === undefined || _builtin_1.BuiltIn.searchBuiltin(name) === undefined || _builtin_1.BuiltIn.hasUnnamedArgument(name)) {
38140
+ return;
38141
+ }
38142
+ // a method of the enclosing class takes precedence over the built-in function
38143
+ const meType = (_b = input.scope.findVariable("me")) === null || _b === void 0 ? void 0 : _b.getType();
38144
+ if (meType instanceof basic_1.ObjectReferenceType) {
38145
+ const def = input.scope.findObjectDefinition(meType.getIdentifierName());
38146
+ if (new _object_oriented_1.ObjectOriented(input.scope).searchMethodName(def, name).method !== undefined) {
38147
+ return;
38148
+ }
38149
+ }
38150
+ const message = "Built-in function " + name + " not allowed as CASE/WHEN operand before v740sp02";
38151
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, nameToken, message));
38152
+ }
38099
38153
  //# sourceMappingURL=case.js.map
38100
38154
 
38101
38155
  /***/ },
@@ -39453,10 +39507,22 @@ const basic_types_1 = __webpack_require__(/*! ../basic_types */ "../core/build/s
39453
39507
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
39454
39508
  const _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ "../core/build/src/abap/types/_typed_identifier.js");
39455
39509
  const _reference_1 = __webpack_require__(/*! ../_reference */ "../core/build/src/abap/5_syntax/_reference.js");
39510
+ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
39456
39511
  class CreateData {
39457
39512
  runSyntax(node, input) {
39513
+ const likeLineOf = node.concatTokens().toUpperCase().includes(" LIKE LINE OF ");
39458
39514
  for (const s of node.findDirectExpressions(Expressions.Source)) {
39459
- source_1.Source.runSyntax(s, input);
39515
+ const sourceType = source_1.Source.runSyntax(s, input);
39516
+ if (likeLineOf === true
39517
+ && sourceType !== undefined
39518
+ && !(sourceType instanceof basic_1.TableType)
39519
+ && !(sourceType instanceof basic_1.VoidType)
39520
+ && !(sourceType instanceof basic_1.UnknownType)
39521
+ && !(sourceType instanceof basic_1.AnyType)) {
39522
+ const message = `"${s.concatTokens()}" is not an internal table`;
39523
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
39524
+ return;
39525
+ }
39460
39526
  }
39461
39527
  for (const t of node.findDirectExpressions(Expressions.Target)) {
39462
39528
  target_1.Target.runSyntax(t, input);
@@ -39641,6 +39707,11 @@ class CreateObject {
39641
39707
  ooName = found.getVoided();
39642
39708
  }
39643
39709
  input.scope.addReference(t === null || t === void 0 ? void 0 : t.getFirstToken(), cdef, _reference_1.ReferenceType.ConstructorReference, input.filename, { ooName: ooName });
39710
+ if (type && type.get() instanceof Expressions.Dynamic) {
39711
+ // the class is only known at runtime, cdef is the static type of the target
39712
+ this.validateParameters(undefined, node, input);
39713
+ return;
39714
+ }
39644
39715
  if (cdef !== undefined) {
39645
39716
  const err = CreateObject.checkInstantiationAllowed(cdef, input);
39646
39717
  if (err) {
@@ -47152,11 +47223,15 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
47152
47223
  exports.When = void 0;
47153
47224
  const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
47154
47225
  const source_1 = __webpack_require__(/*! ../expressions/source */ "../core/build/src/abap/5_syntax/expressions/source.js");
47226
+ const case_1 = __webpack_require__(/*! ./case */ "../core/build/src/abap/5_syntax/statements/case.js");
47155
47227
  class When {
47156
47228
  runSyntax(node, input) {
47157
47229
  for (const s of node.findAllExpressions(Expressions.Source)) {
47158
47230
  source_1.Source.runSyntax(s, input);
47159
47231
  }
47232
+ for (const s of node.findDirectExpressions(Expressions.Source)) {
47233
+ (0, case_1.checkCaseOperand)(s, input);
47234
+ }
47160
47235
  }
47161
47236
  }
47162
47237
  exports.When = When;
@@ -70690,7 +70765,7 @@ class Registry {
70690
70765
  }
70691
70766
  static abaplintVersion() {
70692
70767
  // magic, see build script "version.js"
70693
- return "2.120.59";
70768
+ return "2.120.61";
70694
70769
  }
70695
70770
  getDDICReferences() {
70696
70771
  return this.ddicReferences;
@@ -71323,12 +71398,13 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#abap-doc-on
71323
71398
  return issues;
71324
71399
  }
71325
71400
  getAbapdoc(rows, pos) {
71401
+ var _a, _b, _c;
71326
71402
  let previousRow = pos.getRow() - 2;
71327
- let rowText = rows[previousRow].trim().toUpperCase();
71403
+ let rowText = ((_a = rows[previousRow]) !== null && _a !== void 0 ? _a : "").trim().toUpperCase();
71328
71404
  const text = [];
71329
71405
  if (rowText === "METHODS" || rowText === "CLASS-METHODS") {
71330
71406
  previousRow--;
71331
- rowText = rows[previousRow].trim().toUpperCase();
71407
+ rowText = ((_b = rows[previousRow]) !== null && _b !== void 0 ? _b : "").trim().toUpperCase();
71332
71408
  }
71333
71409
  text.push(rowText);
71334
71410
  //we need to push the first row despite if it is actually an abapdoc or not
@@ -71336,7 +71412,7 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#abap-doc-on
71336
71412
  if (rowText.trim().substring(0, 2) === "\"!") {
71337
71413
  while (previousRow >= 0) {
71338
71414
  previousRow--;
71339
- rowText = rows[previousRow].trim().toUpperCase();
71415
+ rowText = ((_c = rows[previousRow]) !== null && _c !== void 0 ? _c : "").trim().toUpperCase();
71340
71416
  if (rowText.trim().substring(0, 2) !== "\"!") {
71341
71417
  break;
71342
71418
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.59",
3
+ "version": "2.120.61",
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.120.59",
42
+ "@abaplint/core": "^2.120.61",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",