@abaplint/cli 2.120.86 → 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 +156 -12
  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;
@@ -28802,6 +28807,7 @@ const expressions_1 = __webpack_require__(/*! ../2_statements/expressions */ "..
28802
28807
  const _builtin_1 = __webpack_require__(/*! ./_builtin */ "../core/build/src/abap/5_syntax/_builtin.js");
28803
28808
  const position_1 = __webpack_require__(/*! ../../position */ "../core/build/src/position.js");
28804
28809
  const _syntax_input_1 = __webpack_require__(/*! ./_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
28810
+ const version_1 = __webpack_require__(/*! ../../version */ "../core/build/src/version.js");
28805
28811
  class BasicTypes {
28806
28812
  constructor(input) {
28807
28813
  this.input = input;
@@ -29027,7 +29033,14 @@ class BasicTypes {
29027
29033
  }
29028
29034
  const chainText = typeName.concatTokens().toUpperCase();
29029
29035
  const f = this.input.scope.getDDIC().lookupBuiltinType(chainText, length, decimals, qualifiedName);
29030
- if (f !== undefined) {
29036
+ if (f instanceof Types.Integer8Type
29037
+ && !(0, version_1.releaseAtLeast)(this.input.scope.getRelease(), version_1.Release.v750)
29038
+ && !this.input.scope.getOpenABAP()) {
29039
+ const message = "Type INT8 requires 7.50";
29040
+ this.input.issues.push((0, _syntax_input_1.syntaxIssue)(this.input, typeName.getFirstToken(), message));
29041
+ return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
29042
+ }
29043
+ else if (f !== undefined) {
29031
29044
  return f;
29032
29045
  }
29033
29046
  const typ = this.input.scope.findType(chainText);
@@ -43511,6 +43524,10 @@ class InsertInternal {
43511
43524
  if (sourceType instanceof basic_1.IntegerType && targetType instanceof basic_1.Integer8Type) {
43512
43525
  error = true;
43513
43526
  }
43527
+ else if (targetType instanceof basic_1.TableType && targetType.isWithHeader() && sourceType instanceof basic_1.TableType) {
43528
+ // LINES OF into a table with header line, compare the row types
43529
+ error = new _type_utils_1.TypeUtils(input.scope).isAssignable(sourceType.getRowType(), targetType.getRowType()) === false;
43530
+ }
43514
43531
  else if (new _type_utils_1.TypeUtils(input.scope).isAssignable(sourceType, targetType) === false) {
43515
43532
  error = true;
43516
43533
  }
@@ -60324,8 +60341,8 @@ var __importStar = (this && this.__importStar) || (function () {
60324
60341
  };
60325
60342
  })();
60326
60343
  Object.defineProperty(exports, "__esModule", ({ value: true }));
60327
- 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;
60328
- 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;
60329
60346
  const issue_1 = __webpack_require__(/*! ./issue */ "../core/build/src/issue.js");
60330
60347
  Object.defineProperty(exports, "Issue", ({ enumerable: true, get: function () { return issue_1.Issue; } }));
60331
60348
  const config_1 = __webpack_require__(/*! ./config */ "../core/build/src/config.js");
@@ -60422,6 +60439,8 @@ Object.defineProperty(exports, "DDLParser", ({ enumerable: true, get: function (
60422
60439
  Object.defineProperty(exports, "DDLKind", ({ enumerable: true, get: function () { return ddl_parser_1.DDLKind; } }));
60423
60440
  const cds_parser_1 = __webpack_require__(/*! ./cds/cds_parser */ "../core/build/src/cds/cds_parser.js");
60424
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; } }));
60425
60444
  const rules_runner_1 = __webpack_require__(/*! ./rules_runner */ "../core/build/src/rules_runner.js");
60426
60445
  Object.defineProperty(exports, "RulesRunner", ({ enumerable: true, get: function () { return rules_runner_1.RulesRunner; } }));
60427
60446
  const _irule_1 = __webpack_require__(/*! ./rules/_irule */ "../core/build/src/rules/_irule.js");
@@ -72662,7 +72681,7 @@ class Registry {
72662
72681
  }
72663
72682
  static abaplintVersion() {
72664
72683
  // magic, see build script "version.js"
72665
- return "2.120.86";
72684
+ return "2.120.88";
72666
72685
  }
72667
72686
  getDDICReferences() {
72668
72687
  return this.ddicReferences;
@@ -76319,6 +76338,7 @@ const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/ex
76319
76338
  const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
76320
76339
  const Structures = __importStar(__webpack_require__(/*! ../abap/3_structures/structures */ "../core/build/src/abap/3_structures/structures/index.js"));
76321
76340
  const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
76341
+ const tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ "../core/build/src/abap/1_lexer/tokens/index.js");
76322
76342
  class AlignTypeExpressionsConf extends _basic_rule_config_1.BasicRuleConfig {
76323
76343
  constructor() {
76324
76344
  super(...arguments);
@@ -76486,12 +76506,18 @@ ENDINTERFACE.`,
76486
76506
  let column = 0;
76487
76507
  const st = t.findDirectStatements(Statements.Type);
76488
76508
  for (const s of st) {
76489
- const name = s.getChildren()[1];
76509
+ const children = s.getChildren();
76510
+ const length = s.findDirectExpression(Expressions.ConstantFieldLength);
76511
+ const nameEnd = (length !== null && length !== void 0 ? length : children[1]).getLastToken().getEnd();
76512
+ const after = children[length ? 3 : 2];
76513
+ if (after === undefined || after.getFirstToken() instanceof tokens_1.Punctuation) {
76514
+ continue; // no TYPE clause, eg. "foo(1)," with implicit type
76515
+ }
76490
76516
  fields.push({
76491
- nameEnd: name.getLastToken().getEnd(),
76492
- after: s.getChildren()[2].getFirstToken().getStart()
76517
+ nameEnd: nameEnd,
76518
+ after: after.getFirstToken().getStart()
76493
76519
  });
76494
- column = Math.max(column, name.getFirstToken().getEnd().getCol() + 1);
76520
+ column = Math.max(column, nameEnd.getCol() + 1);
76495
76521
  }
76496
76522
  issues.push(...this.check(fields, column, file));
76497
76523
  }
@@ -84437,6 +84463,29 @@ Make sure to test the downported code, it might not always be completely correct
84437
84463
  }
84438
84464
  }
84439
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
+ }
84478
+ // INSERT with a 702 built-in function as the operand parses in the low version, but 702
84479
+ // reads the function as a method call, "Method SUBSTRING does not exist"
84480
+ if (ret.length === 0) {
84481
+ for (let i = 0; i < lowStatements.length; i++) {
84482
+ const issue = this.outlineInsertBuiltin(lowStatements[i], highStatements[i], lowFile, highSyntax);
84483
+ if (issue) {
84484
+ ret.push(issue);
84485
+ break;
84486
+ }
84487
+ }
84488
+ }
84440
84489
  // INTO after WHERE parses as a valid SELECT in the low version, but is only allowed in
84441
84490
  // strict SQL syntax, so move it also when the statement is no longer Unknown
84442
84491
  if (ret.length === 0) {
@@ -85269,6 +85318,40 @@ ${indentation}`);
85269
85318
  }
85270
85319
  return undefined;
85271
85320
  }
85321
+ /** INSERT substring( ... ) INTO TABLE tab, the operand is outlined into a variable */
85322
+ outlineInsertBuiltin(low, high, lowFile, highSyntax) {
85323
+ var _a;
85324
+ if (!(high.get() instanceof Statements.InsertInternal)) {
85325
+ return undefined;
85326
+ }
85327
+ else if (this.lowReg.getConfig().isOpenABAP()) {
85328
+ return undefined;
85329
+ }
85330
+ else if (low.getFirstToken().getStart() instanceof virtual_position_1.VirtualPosition) {
85331
+ return undefined;
85332
+ }
85333
+ // the whole operand is the call, a longer expression is outlined by replaceInsertExpression
85334
+ const source = high.getChildren()[1];
85335
+ if (!(source instanceof nodes_1.ExpressionNode)
85336
+ || !(source.get() instanceof Expressions.SimpleSource4 || source.get() instanceof Expressions.Source)
85337
+ || source.getChildren().length !== 1
85338
+ || !(((_a = source.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.MethodCallChain)) {
85339
+ return undefined;
85340
+ }
85341
+ const type = this.builtinReturnType(source, lowFile, highSyntax);
85342
+ if (type === undefined) {
85343
+ return undefined;
85344
+ }
85345
+ const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
85346
+ const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
85347
+ const code = `DATA ${uniqueName} TYPE ${type}.\n` +
85348
+ indentation + `${uniqueName} = ${source.concatTokens()}.\n` +
85349
+ indentation;
85350
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);
85351
+ const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);
85352
+ const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
85353
+ return issue_1.Issue.atToken(lowFile, source.getFirstToken(), "Outline built-in function in INSERT", this.getMetadata().key, this.conf.severity, fix);
85354
+ }
85272
85355
  /** the ABAP type returned by the built-in function this Source starts with, or undefined
85273
85356
  * if it does not start with one, or with one that predates 702 */
85274
85357
  builtinReturnType(source, lowFile, highSyntax) {
@@ -86973,6 +87056,67 @@ ${indentation} output = ${uniqueName}.\n`;
86973
87056
  }
86974
87057
  return undefined;
86975
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
+ }
86976
87120
  /** if the source expression is the complete source of an INSERT or APPEND statement, then the
86977
87121
  * outlined variable must be typed via the row type of the table, returns the table name */
86978
87122
  findRowTypeOf(high, source) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.86",
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.86",
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",