@abaplint/cli 2.120.87 → 2.120.88

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 +87 -7
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -5230,10 +5230,15 @@ class FormParamType extends combi_1.Expression {
5230
5230
  getRunnable() {
5231
5231
  const def = (0, combi_1.seq)("DEFAULT", (0, combi_1.alt)(_1.Constant, _1.FieldChain));
5232
5232
  const table = (0, combi_1.seq)((0, combi_1.alt)("STANDARD", "HASHED", "INDEX", "SORTED", "ANY"), "TABLE");
5233
- const tabseq = (0, combi_1.seq)(table, (0, combi_1.optPrio)((0, combi_1.seq)("OF", _1.TypeName)));
5234
- const ret = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.alt)("REF TO", "LINE OF")), _1.TypeName, (0, combi_1.opt)(def));
5235
- const like = (0, combi_1.seq)("LIKE", (0, combi_1.optPrio)((0, combi_1.alt)("REF TO", "LINE OF")), _1.FieldChain);
5236
- return (0, combi_1.alt)((0, combi_1.seq)("TYPE", (0, combi_1.altPrio)(tabseq, (0, combi_1.ver)(version_1.Release.v916, (0, combi_1.seq)("ANY", "STRUCTURE")), ret)), like);
5233
+ // the following are not valid FORM typings, fail instead of reading the
5234
+ // remaining words as additional parameters
5235
+ const inline = (0, combi_1.seq)((0, combi_1.alt)("TABLE", "RANGE"), "OF", (0, combi_1.failCombinator)());
5236
+ const tableKey = (0, combi_1.seq)("WITH", (0, combi_1.failCombinator)());
5237
+ const lengthDecimals = (0, combi_1.seq)((0, combi_1.alt)("LENGTH", "DECIMALS"), _1.Integer, (0, combi_1.failCombinator)());
5238
+ const tabseq = (0, combi_1.seq)(table, (0, combi_1.optPrio)((0, combi_1.seq)("OF", (0, combi_1.altPrio)((0, combi_1.seq)("REF TO", (0, combi_1.failCombinator)()), _1.TypeName))), (0, combi_1.optPrio)(tableKey));
5239
+ const ret = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.alt)("REF TO", "LINE OF")), _1.TypeName, (0, combi_1.optPrio)(lengthDecimals), (0, combi_1.opt)(def));
5240
+ const like = (0, combi_1.seq)("LIKE", (0, combi_1.altPrio)(inline, (0, combi_1.seq)(table, (0, combi_1.failCombinator)()), (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.alt)("REF TO", "LINE OF")), _1.FieldChain)));
5241
+ return (0, combi_1.alt)((0, combi_1.seq)("TYPE", (0, combi_1.altPrio)(tabseq, (0, combi_1.ver)(version_1.Release.v916, (0, combi_1.seq)("ANY", "STRUCTURE")), inline, ret)), like);
5237
5242
  }
5238
5243
  }
5239
5244
  exports.FormParamType = FormParamType;
@@ -60336,8 +60341,8 @@ var __importStar = (this && this.__importStar) || (function () {
60336
60341
  };
60337
60342
  })();
60338
60343
  Object.defineProperty(exports, "__esModule", ({ value: true }));
60339
- exports.ABAPObject = exports.Tokens = exports.ExpressionsCDS = exports.CDSParser = exports.LanguageServerTypes = exports.DDLKind = exports.DDLParser = exports.AbstractFile = exports.ABAPFile = exports.MemoryFile = exports.Edits = exports.ReferenceType = exports.NativeSQL = exports.MacroContent = exports.MacroCall = exports.SpaghettiScopeNode = exports.Token = exports.ScopeType = exports.BasicTypes = exports.TypedIdentifier = exports.AbstractType = exports.VirtualPosition = exports.Comment = exports.Unknown = exports.Empty = exports.Identifier = exports.Nodes = exports.Types = exports.Expressions = exports.Statements = exports.Structures = exports.SkipLogic = exports.Objects = exports.ArtifactsRules = exports.ArtifactsObjects = exports.ArtifactsABAP = exports.BuiltIn = exports.FormLengthStats = exports.FunctionLengthStats = exports.MethodLengthStats = exports.LanguageServer = exports.Registry = exports.CyclomaticComplexityStats = exports.versionToABAPRelease = exports.releaseAtLeast = exports.Release = exports.LanguageVersion = exports.Version = exports.Config = exports.Issue = void 0;
60340
- exports.LSPEdit = exports.RuleTag = exports.Severity = exports.Visibility = exports.Info = exports.Diagnostics = exports.Rename = exports.PrettyPrinter = exports.Position = exports.CurrentScope = exports.RulesRunner = exports.SpaghettiScope = exports.SyntaxLogic = void 0;
60344
+ exports.Tokens = exports.ABAPParser = exports.ExpressionsCDS = exports.CDSParser = exports.LanguageServerTypes = exports.DDLKind = exports.DDLParser = exports.AbstractFile = exports.ABAPFile = exports.MemoryFile = exports.Edits = exports.ReferenceType = exports.NativeSQL = exports.MacroContent = exports.MacroCall = exports.SpaghettiScopeNode = exports.Token = exports.ScopeType = exports.BasicTypes = exports.TypedIdentifier = exports.AbstractType = exports.VirtualPosition = exports.Comment = exports.Unknown = exports.Empty = exports.Identifier = exports.Nodes = exports.Types = exports.Expressions = exports.Statements = exports.Structures = exports.SkipLogic = exports.Objects = exports.ArtifactsRules = exports.ArtifactsObjects = exports.ArtifactsABAP = exports.BuiltIn = exports.FormLengthStats = exports.FunctionLengthStats = exports.MethodLengthStats = exports.LanguageServer = exports.Registry = exports.CyclomaticComplexityStats = exports.versionToABAPRelease = exports.releaseAtLeast = exports.Release = exports.LanguageVersion = exports.Version = exports.Config = exports.Issue = void 0;
60345
+ exports.LSPEdit = exports.RuleTag = exports.Severity = exports.Visibility = exports.Info = exports.Diagnostics = exports.Rename = exports.PrettyPrinter = exports.Position = exports.CurrentScope = exports.RulesRunner = exports.SpaghettiScope = exports.SyntaxLogic = exports.ABAPObject = void 0;
60341
60346
  const issue_1 = __webpack_require__(/*! ./issue */ "../core/build/src/issue.js");
60342
60347
  Object.defineProperty(exports, "Issue", ({ enumerable: true, get: function () { return issue_1.Issue; } }));
60343
60348
  const config_1 = __webpack_require__(/*! ./config */ "../core/build/src/config.js");
@@ -60434,6 +60439,8 @@ Object.defineProperty(exports, "DDLParser", ({ enumerable: true, get: function (
60434
60439
  Object.defineProperty(exports, "DDLKind", ({ enumerable: true, get: function () { return ddl_parser_1.DDLKind; } }));
60435
60440
  const cds_parser_1 = __webpack_require__(/*! ./cds/cds_parser */ "../core/build/src/cds/cds_parser.js");
60436
60441
  Object.defineProperty(exports, "CDSParser", ({ enumerable: true, get: function () { return cds_parser_1.CDSParser; } }));
60442
+ const abap_parser_1 = __webpack_require__(/*! ./abap/abap_parser */ "../core/build/src/abap/abap_parser.js");
60443
+ Object.defineProperty(exports, "ABAPParser", ({ enumerable: true, get: function () { return abap_parser_1.ABAPParser; } }));
60437
60444
  const rules_runner_1 = __webpack_require__(/*! ./rules_runner */ "../core/build/src/rules_runner.js");
60438
60445
  Object.defineProperty(exports, "RulesRunner", ({ enumerable: true, get: function () { return rules_runner_1.RulesRunner; } }));
60439
60446
  const _irule_1 = __webpack_require__(/*! ./rules/_irule */ "../core/build/src/rules/_irule.js");
@@ -72674,7 +72681,7 @@ class Registry {
72674
72681
  }
72675
72682
  static abaplintVersion() {
72676
72683
  // magic, see build script "version.js"
72677
- return "2.120.87";
72684
+ return "2.120.88";
72678
72685
  }
72679
72686
  getDDICReferences() {
72680
72687
  return this.ddicReferences;
@@ -84456,6 +84463,18 @@ Make sure to test the downported code, it might not always be completely correct
84456
84463
  }
84457
84464
  }
84458
84465
  }
84466
+ // a chained call with EXPORTING/IMPORTING/CHANGING/RECEIVING/EXCEPTIONS parses in the low
84467
+ // version, but 702 reads the last call of a chain as a functional call,
84468
+ // "Unexpected word CHANGING in functional method call"
84469
+ if (ret.length === 0) {
84470
+ for (let i = 0; i < lowStatements.length; i++) {
84471
+ const issue = this.outlineChainedCallParameters(lowStatements[i], highStatements[i], lowFile, highSyntax);
84472
+ if (issue) {
84473
+ ret.push(issue);
84474
+ break;
84475
+ }
84476
+ }
84477
+ }
84459
84478
  // INSERT with a 702 built-in function as the operand parses in the low version, but 702
84460
84479
  // reads the function as a method call, "Method SUBSTRING does not exist"
84461
84480
  if (ret.length === 0) {
@@ -87037,6 +87056,67 @@ ${indentation} output = ${uniqueName}.\n`;
87037
87056
  }
87038
87057
  return undefined;
87039
87058
  }
87059
+ /** a( )->b( CHANGING c = d ), the object the last method is called on is outlined into a
87060
+ * variable typed via the RETURNING parameter of the method before it */
87061
+ outlineChainedCallParameters(low, high, lowFile, highSyntax) {
87062
+ var _a, _b, _c, _d;
87063
+ if (!(high.get() instanceof Statements.Call)) {
87064
+ return undefined;
87065
+ }
87066
+ else if (this.lowReg.getConfig().isOpenABAP()) {
87067
+ return undefined;
87068
+ }
87069
+ else if (low.getFirstToken().getStart() instanceof virtual_position_1.VirtualPosition) {
87070
+ return undefined;
87071
+ }
87072
+ const chain = high.findDirectExpression(Expressions.MethodCallChain);
87073
+ const children = (chain === null || chain === void 0 ? void 0 : chain.getChildren()) || [];
87074
+ const last = children[children.length - 1];
87075
+ const arrow = children[children.length - 2];
87076
+ const previous = children[children.length - 3];
87077
+ if (chain === undefined
87078
+ || !(last instanceof nodes_1.ExpressionNode)
87079
+ || !(last.get() instanceof Expressions.MethodCall)
87080
+ || (arrow === null || arrow === void 0 ? void 0 : arrow.getFirstToken().getStr()) !== "->"
87081
+ || !(previous instanceof nodes_1.ExpressionNode)
87082
+ || !(previous.get() instanceof Expressions.MethodCall)) {
87083
+ return undefined;
87084
+ }
87085
+ const parameters = (_a = last.findDirectExpression(Expressions.MethodCallParam)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.MethodParameters);
87086
+ if (parameters === undefined) {
87087
+ return undefined;
87088
+ }
87089
+ // the type of the object, from the method that returns it
87090
+ const methodToken = (_b = previous.findDirectExpression(Expressions.MethodName)) === null || _b === void 0 ? void 0 : _b.getFirstToken();
87091
+ if (methodToken === undefined) {
87092
+ return undefined;
87093
+ }
87094
+ const spag = highSyntax.spaghetti.lookupPosition(methodToken.getStart(), lowFile.getFilename());
87095
+ let type = undefined;
87096
+ for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {
87097
+ if (r.referenceType === _reference_1.ReferenceType.MethodReference
87098
+ && r.position.getStart().equals(methodToken.getStart())) {
87099
+ const returning = (_d = (_c = r.resolved) === null || _c === void 0 ? void 0 : _c.getParameters().getReturning()) === null || _d === void 0 ? void 0 : _d.getType();
87100
+ if (returning instanceof basic_1.ObjectReferenceType) {
87101
+ type = returning.toABAP();
87102
+ }
87103
+ break;
87104
+ }
87105
+ }
87106
+ if (type === undefined) {
87107
+ return undefined;
87108
+ }
87109
+ const object = children.slice(0, children.length - 2).map(c => c.concatTokens()).join("");
87110
+ const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
87111
+ const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
87112
+ const code = `DATA ${uniqueName} TYPE ${type}.\n` +
87113
+ indentation + `${uniqueName} = ${object}.\n` +
87114
+ indentation;
87115
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);
87116
+ const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, chain.getFirstToken().getStart(), previous.getLastToken().getEnd(), uniqueName);
87117
+ const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
87118
+ return issue_1.Issue.atToken(lowFile, chain.getFirstToken(), "Outline object of chained call with parameter keywords", this.getMetadata().key, this.conf.severity, fix);
87119
+ }
87040
87120
  /** if the source expression is the complete source of an INSERT or APPEND statement, then the
87041
87121
  * outlined variable must be typed via the row type of the table, returns the table name */
87042
87122
  findRowTypeOf(high, source) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.87",
3
+ "version": "2.120.88",
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.87",
42
+ "@abaplint/core": "^2.120.88",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",