@abaplint/cli 2.120.89 → 2.120.90

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 -6
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -32152,6 +32152,7 @@ class FieldChain {
32152
32152
  const children = node.getChildren();
32153
32153
  context = this.findTop(children[0], input, refType);
32154
32154
  let prev = children[0].concatTokens();
32155
+ let afterTableExpression = false;
32155
32156
  for (let i = 1; i < children.length; i++) {
32156
32157
  const current = children[i];
32157
32158
  if (current === undefined) {
@@ -32199,6 +32200,9 @@ class FieldChain {
32199
32200
  }
32200
32201
  }
32201
32202
  else if (current.get() instanceof tokens_1.InstanceArrow) {
32203
+ if (afterTableExpression && table_expression_1.TableExpression.checkArrowAfter(input, current.getFirstToken())) {
32204
+ return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
32205
+ }
32202
32206
  if (!(context instanceof basic_1.ObjectReferenceType)
32203
32207
  && !(context instanceof basic_1.DataReference)
32204
32208
  && !(context instanceof basic_1.VoidType)) {
@@ -32231,6 +32235,7 @@ class FieldChain {
32231
32235
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
32232
32236
  }
32233
32237
  table_expression_1.TableExpression.runSyntax(current, input, context);
32238
+ afterTableExpression = true;
32234
32239
  if (!(context instanceof basic_1.VoidType) && !(context instanceof basic_1.UnknownType)) {
32235
32240
  context = context.getRowType();
32236
32241
  }
@@ -33586,6 +33591,7 @@ const method_call_param_1 = __webpack_require__(/*! ./method_call_param */ "../c
33586
33591
  const _reference_1 = __webpack_require__(/*! ../_reference */ "../core/build/src/abap/5_syntax/_reference.js");
33587
33592
  const component_name_1 = __webpack_require__(/*! ./component_name */ "../core/build/src/abap/5_syntax/expressions/component_name.js");
33588
33593
  const attribute_name_1 = __webpack_require__(/*! ./attribute_name */ "../core/build/src/abap/5_syntax/expressions/attribute_name.js");
33594
+ const table_expression_1 = __webpack_require__(/*! ./table_expression */ "../core/build/src/abap/5_syntax/expressions/table_expression.js");
33589
33595
  const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
33590
33596
  class MethodCallChain {
33591
33597
  static runSyntax(node, input, targetType) {
@@ -33598,6 +33604,13 @@ class MethodCallChain {
33598
33604
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
33599
33605
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
33600
33606
  }
33607
+ // the field chain is followed by "->", eg. "itab[ 1 ]-ref->meth( )"
33608
+ if (first instanceof nodes_1.ExpressionNode
33609
+ && first.get() instanceof Expressions.FieldChain
33610
+ && first.findDirectExpression(Expressions.TableExpression) !== undefined
33611
+ && table_expression_1.TableExpression.checkArrowAfter(input, children[1].getFirstToken())) {
33612
+ return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
33613
+ }
33601
33614
  let currentIndex = 1;
33602
33615
  let context = this.findTop(first, input, targetType);
33603
33616
  if (first.get() instanceof Expressions.MethodCall) {
@@ -37007,9 +37020,23 @@ exports.TableExpression = void 0;
37007
37020
  const nodes_1 = __webpack_require__(/*! ../../nodes */ "../core/build/src/abap/nodes/index.js");
37008
37021
  const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
37009
37022
  const source_1 = __webpack_require__(/*! ./source */ "../core/build/src/abap/5_syntax/expressions/source.js");
37023
+ const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
37010
37024
  const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
37011
37025
  const component_chain_1 = __webpack_require__(/*! ./component_chain */ "../core/build/src/abap/5_syntax/expressions/component_chain.js");
37026
+ const version_1 = __webpack_require__(/*! ../../../version */ "../core/build/src/version.js");
37012
37027
  class TableExpression {
37028
+ /** below v750 the object component selector "->" cannot follow a table expression, eg. "itab[ 1 ]-ref->meth( )",
37029
+ * returns true and adds an issue if not allowed */
37030
+ static checkArrowAfter(input, arrow) {
37031
+ if ((0, version_1.releaseAtLeast)(input.scope.getRelease(), version_1.Release.v750)
37032
+ || input.scope.getLanguageVersion() === version_1.LanguageVersion.Cloud
37033
+ || input.scope.getOpenABAP()) {
37034
+ return false;
37035
+ }
37036
+ const message = "Object component selector \"->\" after table expression not possible below v750";
37037
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, arrow, message));
37038
+ return true;
37039
+ }
37013
37040
  static runSyntax(node, input, rowType) {
37014
37041
  if (node === undefined) {
37015
37042
  return;
@@ -37126,6 +37153,7 @@ class Target {
37126
37153
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
37127
37154
  }
37128
37155
  let currentIndex = 1;
37156
+ let afterTableExpression = false;
37129
37157
  while (currentIndex <= children.length) {
37130
37158
  const current = children[currentIndex];
37131
37159
  if (current === undefined) {
@@ -37151,6 +37179,9 @@ class Target {
37151
37179
  }
37152
37180
  }
37153
37181
  else if (current.get() instanceof tokens_1.InstanceArrow) {
37182
+ if (afterTableExpression && table_expression_1.TableExpression.checkArrowAfter(input, current.getFirstToken())) {
37183
+ return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
37184
+ }
37154
37185
  if (!(context instanceof basic_1.ObjectReferenceType)
37155
37186
  && !(context instanceof basic_1.DataReference)
37156
37187
  && !(context instanceof basic_1.VoidType)) {
@@ -37199,6 +37230,7 @@ class Target {
37199
37230
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
37200
37231
  }
37201
37232
  table_expression_1.TableExpression.runSyntax(current, input, context);
37233
+ afterTableExpression = true;
37202
37234
  if (!(context instanceof basic_1.VoidType) && !(context instanceof unknown_type_1.UnknownType)) {
37203
37235
  context = context.getRowType();
37204
37236
  }
@@ -65381,8 +65413,12 @@ exports.DataControl = DataControl;
65381
65413
 
65382
65414
  Object.defineProperty(exports, "__esModule", ({ value: true }));
65383
65415
  exports.DataDefinition = void 0;
65416
+ const tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ "../core/build/src/abap/1_lexer/tokens/index.js");
65417
+ const combi_1 = __webpack_require__(/*! ../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
65384
65418
  const nodes_1 = __webpack_require__(/*! ../abap/nodes */ "../core/build/src/abap/nodes/index.js");
65385
65419
  const cds_determine_types_1 = __webpack_require__(/*! ../cds/cds_determine_types */ "../core/build/src/cds/cds_determine_types.js");
65420
+ const cds_lexer_1 = __webpack_require__(/*! ../cds/cds_lexer */ "../core/build/src/cds/cds_lexer.js");
65421
+ const version_1 = __webpack_require__(/*! ../version */ "../core/build/src/version.js");
65386
65422
  const cds_parser_1 = __webpack_require__(/*! ../cds/cds_parser */ "../core/build/src/cds/cds_parser.js");
65387
65423
  const expressions_1 = __webpack_require__(/*! ../cds/expressions */ "../core/build/src/cds/expressions/index.js");
65388
65424
  const _abstract_object_1 = __webpack_require__(/*! ./_abstract_object */ "../core/build/src/objects/_abstract_object.js");
@@ -65474,8 +65510,8 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
65474
65510
  associations: [],
65475
65511
  tree: undefined,
65476
65512
  };
65477
- this.findSQLViewName();
65478
65513
  this.parsedData.tree = new cds_parser_1.CDSParser().parse(this.findSourceFile());
65514
+ this.findSQLViewName(this.parsedData.tree);
65479
65515
  if (this.parsedData.tree) {
65480
65516
  for (const c of ((_a = this.parsedData.tree) === null || _a === void 0 ? void 0 : _a.getChildren()) || []) {
65481
65517
  if (c.get() instanceof expressions_1.CDSAnnotation) {
@@ -65500,11 +65536,30 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
65500
65536
  return (_a = this.parsedData) === null || _a === void 0 ? void 0 : _a.tree;
65501
65537
  }
65502
65538
  //////////
65503
- findSQLViewName() {
65539
+ findSQLViewName(tree) {
65504
65540
  var _a;
65505
- const match = (_a = this.findSourceFile()) === null || _a === void 0 ? void 0 : _a.getRaw().match(/@AbapCatalog\.sqlViewName: '([\w/]+)'/);
65506
- if (match) {
65507
- this.parsedData.sqlViewName = match[1].toUpperCase();
65541
+ let annotations = tree === null || tree === void 0 ? void 0 : tree.findDirectExpressions(expressions_1.CDSAnnotation);
65542
+ if (annotations === undefined) {
65543
+ const file = this.findSourceFile();
65544
+ if (file === undefined) {
65545
+ return;
65546
+ }
65547
+ // Keep SQL view lookup available even when the view body cannot be parsed.
65548
+ const tokens = cds_lexer_1.CDSLexer.run(file).filter(t => !(t instanceof tokens_1.Comment));
65549
+ const leadingAnnotations = (0, combi_1.seq)((0, combi_1.starPrio)(expressions_1.CDSAnnotation), (0, combi_1.starPrio)((0, combi_1.regex)(/.*/)));
65550
+ annotations = (_a = combi_1.Combi.run(leadingAnnotations, tokens, version_1.defaultRelease)) === null || _a === void 0 ? void 0 : _a.filter((n) => n instanceof nodes_1.ExpressionNode && n.get() instanceof expressions_1.CDSAnnotation);
65551
+ }
65552
+ for (const annotation of annotations || []) {
65553
+ const tokens = annotation.getTokens().map(t => t.getStr());
65554
+ const colon = tokens.indexOf(":");
65555
+ if (tokens.slice(0, colon).join("") !== "@AbapCatalog.sqlViewName") {
65556
+ continue;
65557
+ }
65558
+ const match = tokens.slice(colon + 1).join(" ").match(/^'([\w/]+)'$/);
65559
+ if (match) {
65560
+ this.parsedData.sqlViewName = match[1].toUpperCase();
65561
+ return;
65562
+ }
65508
65563
  }
65509
65564
  }
65510
65565
  findDescription() {
@@ -72722,7 +72777,7 @@ class Registry {
72722
72777
  }
72723
72778
  static abaplintVersion() {
72724
72779
  // magic, see build script "version.js"
72725
- return "2.120.89";
72780
+ return "2.120.90";
72726
72781
  }
72727
72782
  getDDICReferences() {
72728
72783
  return this.ddicReferences;
@@ -112149,6 +112204,7 @@ class XMLConsistency {
112149
112204
  extendedInformation: `Checks:
112150
112205
  * XML is well-formed and parseable
112151
112206
  * Naming for CLAS and INTF objects
112207
+ * CLAS and INTF objects do not contain fields that abapGit clears, eg. AUTHOR, CREATEDON and VERSION
112152
112208
  * QUAN fields in TABL objects have reference table and field values
112153
112209
  * Transparent TABL objects have delivery class and size category set
112154
112210
  * TABL fields with a built-in type carry the INTTYPE abapGit serializes for it, for the confirmed pairs
@@ -112234,6 +112290,22 @@ class XMLConsistency {
112234
112290
  else if (((_a = obj.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getStructure()) !== undefined && obj.getClassDefinition() === undefined) {
112235
112291
  issues.push(issue_1.Issue.atRow(file, 1, "Class matching XML name not found in ABAP file", this.getMetadata().key, this.conf.severity));
112236
112292
  }
112293
+ issues.push(...this.checkClearedFields(obj, file, "VSEOCLASS", XMLConsistency.clearedClassFields));
112294
+ return issues;
112295
+ }
112296
+ checkClearedFields(obj, file, structure, fields) {
112297
+ var _a, _b;
112298
+ const issues = [];
112299
+ const block = (_b = (_a = obj.getXML()) === null || _a === void 0 ? void 0 : _a.match(new RegExp(`<${structure}>([\\s\\S]*?)</${structure}>`))) === null || _b === void 0 ? void 0 : _b[1];
112300
+ if (block === undefined) {
112301
+ return issues;
112302
+ }
112303
+ for (const field of fields) {
112304
+ if (block.match(new RegExp(`<${field}[\\s/>]`)) !== null) {
112305
+ const message = `Field ${field} in ${structure} is cleared by abapGit and should not be in the XML`;
112306
+ issues.push(issue_1.Issue.atRow(file, 1, message, this.getMetadata().key, this.conf.severity));
112307
+ }
112308
+ }
112237
112309
  return issues;
112238
112310
  }
112239
112311
  runTextPool(obj, file) {
@@ -112267,6 +112339,7 @@ class XMLConsistency {
112267
112339
  else if (obj.getDefinition() !== undefined && ((_a = obj.getDefinition()) === null || _a === void 0 ? void 0 : _a.getName().toUpperCase()) !== name.toUpperCase()) {
112268
112340
  issues.push(issue_1.Issue.atRow(file, 1, "Interface matching XML name not found in ABAP file", this.getMetadata().key, this.conf.severity));
112269
112341
  }
112342
+ issues.push(...this.checkClearedFields(obj, file, "VSEOINTERF", XMLConsistency.clearedInterfaceFields));
112270
112343
  return issues;
112271
112344
  }
112272
112345
  checkTextLength(file, fieldName, text, maxLength, lang) {
@@ -112447,6 +112520,14 @@ class XMLConsistency {
112447
112520
  }
112448
112521
  }
112449
112522
  exports.XMLConsistency = XMLConsistency;
112523
+ // fields abapGit clears before serializing, see ZCL_ABAPGIT_OO_CLASS and ZCL_ABAPGIT_OO_INTERFACE;
112524
+ // abapGit omits initial fields, so any occurrence shows as a diff on every pull
112525
+ XMLConsistency.clearedInterfaceFields = [
112526
+ "UUID", "AUTHOR", "CREATEDON", "CHANGEDBY", "CHANGEDON", "CHGDANYBY", "CHGDANYON", "R3RELEASE", "VERSION",
112527
+ ];
112528
+ XMLConsistency.clearedClassFields = [
112529
+ ...XMLConsistency.clearedInterfaceFields, "CLSFINAL", "CLSABSTRCT", "EXPOSURE",
112530
+ ];
112450
112531
  // INTTYPE that abapGit serializes for a built-in DATATYPE, confirmed by exported tables;
112451
112532
  // a different value activates, but shows as a diff on every pull
112452
112533
  XMLConsistency.intTypes = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.89",
3
+ "version": "2.120.90",
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.89",
42
+ "@abaplint/core": "^2.120.90",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",