@abaplint/core 2.93.28 → 2.93.30

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.
@@ -993,6 +993,10 @@ declare class ComponentCompareSimple extends Expression {
993
993
  getRunnable(): IStatementRunnable;
994
994
  }
995
995
 
996
+ declare class ComponentCompareSingle extends Expression {
997
+ getRunnable(): IStatementRunnable;
998
+ }
999
+
996
1000
  declare class ComponentCond extends Expression {
997
1001
  getRunnable(): IStatementRunnable;
998
1002
  }
@@ -1821,6 +1825,7 @@ declare namespace Expressions {
1821
1825
  ArithOperator,
1822
1826
  ArrowOrDash,
1823
1827
  Arrow,
1828
+ AssignSource,
1824
1829
  AssociationName,
1825
1830
  AttributeChain,
1826
1831
  AttributeName,
@@ -1830,7 +1835,6 @@ declare namespace Expressions {
1830
1835
  Cast,
1831
1836
  ClassFinal,
1832
1837
  ClassFriends,
1833
- AssignSource,
1834
1838
  ClassGlobal_2 as ClassGlobal,
1835
1839
  ClassName,
1836
1840
  Color,
@@ -1839,9 +1843,10 @@ declare namespace Expressions {
1839
1843
  ComponentChainSimple,
1840
1844
  ComponentChain,
1841
1845
  ComponentCompareSimple,
1846
+ ComponentCompareSingle,
1842
1847
  ComponentCompare,
1843
- ComponentCond,
1844
1848
  ComponentCondSub,
1849
+ ComponentCond,
1845
1850
  ComponentName,
1846
1851
  ConcatenatedConstant,
1847
1852
  CondBody,
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ComponentCompareSingle = void 0;
4
+ const combi_1 = require("../combi");
5
+ const _1 = require(".");
6
+ const component_chain_simple_1 = require("./component_chain_simple");
7
+ class ComponentCompareSingle extends combi_1.Expression {
8
+ getRunnable() {
9
+ const ret = (0, combi_1.seq)((0, combi_1.altPrio)(component_chain_simple_1.ComponentChainSimple, _1.Dynamic), "=", _1.Source);
10
+ return ret;
11
+ }
12
+ }
13
+ exports.ComponentCompareSingle = ComponentCompareSingle;
14
+ //# sourceMappingURL=component_compare_single.js.map
@@ -20,6 +20,7 @@ __exportStar(require("./and_return"), exports);
20
20
  __exportStar(require("./arith_operator"), exports);
21
21
  __exportStar(require("./arrow_or_dash"), exports);
22
22
  __exportStar(require("./arrow"), exports);
23
+ __exportStar(require("./assign_source"), exports);
23
24
  __exportStar(require("./association_name"), exports);
24
25
  __exportStar(require("./attribute_chain"), exports);
25
26
  __exportStar(require("./attribute_name"), exports);
@@ -29,7 +30,6 @@ __exportStar(require("./call_transformation_parameters"), exports);
29
30
  __exportStar(require("./cast"), exports);
30
31
  __exportStar(require("./class_final"), exports);
31
32
  __exportStar(require("./class_friends"), exports);
32
- __exportStar(require("./assign_source"), exports);
33
33
  __exportStar(require("./class_global"), exports);
34
34
  __exportStar(require("./class_name"), exports);
35
35
  __exportStar(require("./color"), exports);
@@ -38,9 +38,10 @@ __exportStar(require("./compare"), exports);
38
38
  __exportStar(require("./component_chain_simple"), exports);
39
39
  __exportStar(require("./component_chain"), exports);
40
40
  __exportStar(require("./component_compare_simple"), exports);
41
+ __exportStar(require("./component_compare_single"), exports);
41
42
  __exportStar(require("./component_compare"), exports);
42
- __exportStar(require("./component_cond"), exports);
43
43
  __exportStar(require("./component_cond_sub"), exports);
44
+ __exportStar(require("./component_cond"), exports);
44
45
  __exportStar(require("./component_name"), exports);
45
46
  __exportStar(require("./concatenated_constant"), exports);
46
47
  __exportStar(require("./cond_body"), exports);
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LoopGroupByComponent = void 0;
4
4
  const combi_1 = require("../combi");
5
5
  const component_name_1 = require("./component_name");
6
- const component_compare_simple_1 = require("./component_compare_simple");
6
+ const component_compare_single_1 = require("./component_compare_single");
7
7
  class LoopGroupByComponent extends combi_1.Expression {
8
8
  getRunnable() {
9
9
  const groupSize = (0, combi_1.seq)(component_name_1.ComponentName, "=", "GROUP SIZE");
10
10
  const groupIndex = (0, combi_1.seq)(component_name_1.ComponentName, "=", "GROUP INDEX");
11
- const components = (0, combi_1.alt)(component_compare_simple_1.ComponentCompareSimple, groupSize, groupIndex);
11
+ const components = (0, combi_1.alt)(component_compare_single_1.ComponentCompareSingle, groupSize, groupIndex);
12
12
  return components;
13
13
  }
14
14
  }
@@ -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
  }
@@ -32,7 +32,7 @@ class LoopGroupBy {
32
32
  */
33
33
  // const sourceType = new StructureType(components);
34
34
  for (const c of node.findDirectExpressions(Expressions.LoopGroupByComponent)) {
35
- for (const t of c.findDirectExpressions(Expressions.ComponentCompareSimple)) {
35
+ for (const t of c.findDirectExpressions(Expressions.ComponentCompareSingle)) {
36
36
  new component_compare_1.ComponentCompare().runSyntax(t, scope, filename);
37
37
  }
38
38
  }
@@ -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.28";
66
+ return "2.93.30";
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) {
@@ -993,6 +993,9 @@ GET REFERENCE OF <${uniqueName}> INTO ${target.concatTokens()}`;
993
993
  groupIndexName = name === null || name === void 0 ? void 0 : name.concatTokens();
994
994
  }
995
995
  else {
996
+ if (condition !== "") {
997
+ condition += " ";
998
+ }
996
999
  condition += c.concatTokens();
997
1000
  type = type.replace(loopTargetName, loopSourceRowType);
998
1001
  type = type.replace("->", "-");
@@ -1030,11 +1033,15 @@ ELSE.\n`;
1030
1033
  code += ` CLEAR ${uniqueName}.\n`;
1031
1034
  for (const c of group.findAllExpressions(Expressions.LoopGroupByComponent)) {
1032
1035
  const concat = c.concatTokens();
1036
+ // console.dir(concat);
1033
1037
  if (concat.endsWith(" GROUP INDEX")) {
1034
1038
  code += ` ${uniqueName}-${groupIndexName} = ${uniqueNameIndex}.\n`;
1035
1039
  }
1040
+ else if (concat.endsWith(" GROUP SIZE")) {
1041
+ code += ` ${uniqueName}-${groupCountName} = 1.\n`;
1042
+ }
1036
1043
  else {
1037
- code += ` ${uniqueName}-${concat.replace("GROUP SIZE", "1")}.\n`;
1044
+ code += ` ${uniqueName}-${concat}.\n`;
1038
1045
  }
1039
1046
  }
1040
1047
  if (singleName !== "") {
@@ -1656,7 +1663,7 @@ ${indentation} output = ${topTarget}.`;
1656
1663
  if (concat.toUpperCase() === "NEXT") {
1657
1664
  continue;
1658
1665
  }
1659
- else if (n.get() instanceof Expressions.Field) {
1666
+ else if (n.get() instanceof Expressions.SimpleFieldChain) {
1660
1667
  body += indentation + " " + concat + " ";
1661
1668
  }
1662
1669
  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.28",
3
+ "version": "2.93.30",
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.23",
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": {