@abaplint/core 2.93.27 → 2.93.29

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.
@@ -8,7 +8,7 @@ const version_1 = require("../../../version");
8
8
  class ReduceNext extends combi_1.Expression {
9
9
  getRunnable() {
10
10
  const calcAssign = (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.alt)((0, combi_1.seq)((0, combi_1.tok)(tokens_1.WPlus), "="), (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WDash), "="), "/=", "*=", "&&="));
11
- const fields = (0, combi_1.seq)(_1.Field, (0, combi_1.altPrio)("=", calcAssign), _1.Source);
11
+ const fields = (0, combi_1.seq)(_1.SimpleFieldChain, (0, combi_1.altPrio)("=", calcAssign), _1.Source);
12
12
  return (0, combi_1.seq)("NEXT", (0, combi_1.plus)(fields));
13
13
  }
14
14
  }
@@ -24,7 +24,7 @@ class BasicTypes {
24
24
  }
25
25
  lookupQualifiedName(name) {
26
26
  var _a;
27
- // argh, todo, rewrite this entire method
27
+ // argh, todo, rewrite this entire method, more argh
28
28
  if (name === undefined) {
29
29
  return undefined;
30
30
  }
@@ -38,9 +38,24 @@ class BasicTypes {
38
38
  const typeName = split[1];
39
39
  const oo = this.scope.findObjectDefinition(ooName);
40
40
  if (oo) {
41
- const f = oo.getTypeDefinitions().getByName(typeName);
42
- if (f) {
43
- return f;
41
+ if (typeName.includes("-")) {
42
+ const split = typeName.split("-");
43
+ const subTypeName = split[0];
44
+ const fieldName = split[1];
45
+ const stru = oo.getTypeDefinitions().getByName(subTypeName);
46
+ const struType = stru === null || stru === void 0 ? void 0 : stru.getType();
47
+ if (stru && struType instanceof basic_1.StructureType) {
48
+ const f = struType.getComponentByName(fieldName);
49
+ if (f) {
50
+ return new _typed_identifier_1.TypedIdentifier(stru.getToken(), stru.getFilename(), f);
51
+ }
52
+ }
53
+ }
54
+ else {
55
+ const f = oo.getTypeDefinitions().getByName(typeName);
56
+ if (f) {
57
+ return f;
58
+ }
44
59
  }
45
60
  }
46
61
  }
@@ -8,6 +8,7 @@ const inline_field_definition_1 = require("./inline_field_definition");
8
8
  const unknown_type_1 = require("../../types/basic/unknown_type");
9
9
  const reduce_next_1 = require("./reduce_next");
10
10
  const let_1 = require("./let");
11
+ const _scope_type_1 = require("../_scope_type");
11
12
  class ReduceBody {
12
13
  runSyntax(node, scope, filename) {
13
14
  if (node === undefined) {
@@ -20,6 +21,10 @@ class ReduceBody {
20
21
  }
21
22
  let first = undefined;
22
23
  for (const i of node.findDirectExpressions(Expressions.InlineFieldDefinition)) {
24
+ if (scoped === false) {
25
+ scope.push(_scope_type_1.ScopeType.Let, "LET", node.getFirstToken().getStart(), filename);
26
+ scoped = true;
27
+ }
23
28
  const found = new inline_field_definition_1.InlineFieldDefinition().runSyntax(i, scope, filename);
24
29
  if (found && first === undefined) {
25
30
  first = found;
@@ -46,6 +46,16 @@ class Describe {
46
46
  new target_1.Target().runSyntax(lengthTarget, scope, filename);
47
47
  }
48
48
  }
49
+ const componentsTarget = node.findExpressionAfterToken("COMPONENTS");
50
+ if ((componentsTarget === null || componentsTarget === void 0 ? void 0 : componentsTarget.get()) instanceof Expressions.Target) {
51
+ const inline = componentsTarget === null || componentsTarget === void 0 ? void 0 : componentsTarget.findDirectExpression(Expressions.InlineData);
52
+ if (inline) {
53
+ new inline_data_1.InlineData().runSyntax(inline, scope, filename, new basic_1.IntegerType());
54
+ }
55
+ else {
56
+ new target_1.Target().runSyntax(componentsTarget, scope, filename);
57
+ }
58
+ }
49
59
  }
50
60
  }
51
61
  exports.Describe = Describe;
@@ -63,7 +63,7 @@ class Registry {
63
63
  }
64
64
  static abaplintVersion() {
65
65
  // magic, see build script "version.sh"
66
- return "2.93.27";
66
+ return "2.93.29";
67
67
  }
68
68
  getDDICReferences() {
69
69
  return this.references;
@@ -11,6 +11,8 @@ class AbapdocConf extends _basic_rule_config_1.BasicRuleConfig {
11
11
  super(...arguments);
12
12
  /** Check local classes and interfaces for abapdoc. */
13
13
  this.checkLocal = false;
14
+ this.classDefinition = false;
15
+ this.interfaceDefinition = false;
14
16
  }
15
17
  }
16
18
  exports.AbapdocConf = AbapdocConf;
@@ -24,7 +26,9 @@ class Abapdoc extends _abap_rule_1.ABAPRule {
24
26
  key: "abapdoc",
25
27
  title: "Check abapdoc",
26
28
  shortDescription: `Various checks regarding abapdoc.
27
- Base rule checks for existence of abapdoc for public class methods and all interface methods.`,
29
+ Base rule checks for existence of abapdoc for public class methods and all interface methods.
30
+
31
+ Plus class and interface definitions.`,
28
32
  tags: [_irule_1.RuleTag.SingleFile],
29
33
  };
30
34
  }
@@ -35,6 +39,7 @@ Base rule checks for existence of abapdoc for public class methods and all inter
35
39
  this.conf = conf;
36
40
  }
37
41
  runParsed(file) {
42
+ var _a, _b;
38
43
  const issues = [];
39
44
  const rows = file.getRawRows();
40
45
  let methods = [];
@@ -43,12 +48,28 @@ Base rule checks for existence of abapdoc for public class methods and all inter
43
48
  continue;
44
49
  }
45
50
  methods = methods.concat(classDef.methods.filter(m => m.visibility === visibility_1.Visibility.Public));
51
+ if (this.getConfig().classDefinition === true) {
52
+ const previousRow = classDef.identifier.getStart().getRow() - 2;
53
+ if (((_a = rows[previousRow]) === null || _a === void 0 ? void 0 : _a.trim().substring(0, 2)) !== "\"!") {
54
+ const message = "Missing ABAP Doc for class " + classDef.identifier.getToken().getStr();
55
+ const issue = issue_1.Issue.atIdentifier(classDef.identifier, message, this.getMetadata().key, this.conf.severity);
56
+ issues.push(issue);
57
+ }
58
+ }
46
59
  }
47
60
  for (const interfaceDef of file.getInfo().listInterfaceDefinitions()) {
48
61
  if (this.conf.checkLocal === false && interfaceDef.isLocal === true) {
49
62
  continue;
50
63
  }
51
64
  methods = methods.concat(interfaceDef.methods);
65
+ if (this.getConfig().interfaceDefinition === true) {
66
+ const previousRow = interfaceDef.identifier.getStart().getRow() - 2;
67
+ if (((_b = rows[previousRow]) === null || _b === void 0 ? void 0 : _b.trim().substring(0, 2)) !== "\"!") {
68
+ const message = "Missing ABAP Doc for interface " + interfaceDef.identifier.getToken().getStr();
69
+ const issue = issue_1.Issue.atIdentifier(interfaceDef.identifier, message, this.getMetadata().key, this.conf.severity);
70
+ issues.push(issue);
71
+ }
72
+ }
52
73
  }
53
74
  for (const method of methods) {
54
75
  if (method.isRedefinition === true) {
@@ -937,6 +937,9 @@ ${indentation}RAISE EXCEPTION ${uniqueName2}.`;
937
937
  if (sourceRef.findFirstExpression(Expressions.TableExpression)) {
938
938
  const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
939
939
  code = `ASSIGN ${sourceRef.concatTokens()} TO FIELD-SYMBOL(<${uniqueName}>).
940
+ IF sy-subrc <> 0.
941
+ RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
942
+ ENDIF.
940
943
  GET REFERENCE OF <${uniqueName}> INTO ${target.concatTokens()}`;
941
944
  }
942
945
  else {
@@ -1473,16 +1476,36 @@ ${indentation} output = ${topTarget}.`;
1473
1476
  if (gby !== "") {
1474
1477
  gby = " GROUP BY ( " + gby + " )";
1475
1478
  }
1479
+ const fc = forLoop.findDirectExpression(Expressions.FieldChain);
1480
+ if (fc) {
1481
+ gby = " GROUP BY " + fc.concatTokens();
1482
+ }
1483
+ if (forLoop.findDirectTokenByText("ASCENDING")) {
1484
+ gby += " ASCENDING";
1485
+ }
1486
+ if (forLoop.findDirectTokenByText("DESCENDING")) {
1487
+ gby += " DESCENDING";
1488
+ }
1476
1489
  const groups = forLoop.findExpressionAfterToken("GROUPS");
1477
1490
  if (groups) {
1478
- gby += " INTO DATA(" + groups.concatTokens() + ")";
1491
+ const concat = groups.concatTokens();
1492
+ if (concat.startsWith("<")) {
1493
+ gby += " ASSIGNING FIELD-SYMBOL(" + concat + ")";
1494
+ }
1495
+ else {
1496
+ gby += " INTO DATA(" + concat + ")";
1497
+ }
1479
1498
  }
1480
1499
  let inGroup = "";
1481
1500
  if (forLoop.concatTokens().toUpperCase().includes(" IN GROUP ")) {
1482
1501
  inGroup = "-items";
1483
1502
  }
1503
+ let into = "INTO DATA";
1504
+ if (loopTargetField.startsWith("<")) {
1505
+ into = "ASSIGNING FIELD-SYMBOL";
1506
+ }
1484
1507
  // todo, also backup sy-index / sy-tabix here?
1485
- body += indentation + `LOOP AT ${loopSource}${inGroup} INTO DATA(${loopTargetField})${from}${to}${cond}${gby}.\n`;
1508
+ body += indentation + `LOOP AT ${loopSource}${inGroup} ${into}(${loopTargetField})${from}${to}${cond}${gby}.\n`;
1486
1509
  if (indexInto) {
1487
1510
  body += indentation + " DATA(" + indexInto + ") = sy-tabix.\n";
1488
1511
  }
@@ -1633,7 +1656,7 @@ ${indentation} output = ${topTarget}.`;
1633
1656
  if (concat.toUpperCase() === "NEXT") {
1634
1657
  continue;
1635
1658
  }
1636
- else if (n.get() instanceof Expressions.Field) {
1659
+ else if (n.get() instanceof Expressions.SimpleFieldChain) {
1637
1660
  body += indentation + " " + concat + " ";
1638
1661
  }
1639
1662
  else if (n.get() instanceof Expressions.Source) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.93.27",
3
+ "version": "2.93.29",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -46,16 +46,16 @@
46
46
  },
47
47
  "homepage": "https://abaplint.org",
48
48
  "devDependencies": {
49
- "@microsoft/api-extractor": "^7.31.1",
49
+ "@microsoft/api-extractor": "^7.31.2",
50
50
  "@types/chai": "^4.3.3",
51
51
  "@types/mocha": "^9.1.1",
52
- "@types/node": "^18.7.18",
52
+ "@types/node": "^18.7.20",
53
53
  "chai": "^4.3.6",
54
- "eslint": "^8.23.1",
54
+ "eslint": "^8.24.0",
55
55
  "mocha": "^10.0.0",
56
56
  "c8": "^7.12.0",
57
57
  "source-map-support": "^0.5.21",
58
- "ts-json-schema-generator": "^1.1.0",
58
+ "ts-json-schema-generator": "^1.1.1",
59
59
  "typescript": "^4.8.3"
60
60
  },
61
61
  "dependencies": {