@abaplint/core 2.113.215 → 2.113.217

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.
@@ -4,7 +4,7 @@ exports.AssociationName = void 0;
4
4
  const combi_1 = require("../combi");
5
5
  class AssociationName extends combi_1.Expression {
6
6
  getRunnable() {
7
- return (0, combi_1.regex)(/^\\_[\w]+$/);
7
+ return (0, combi_1.regex)(/^(\\_[\w]+)+$/);
8
8
  }
9
9
  }
10
10
  exports.AssociationName = AssociationName;
@@ -50,8 +50,10 @@ class FieldChain {
50
50
  }
51
51
  else if (current.get() instanceof tokens_1.Dash) {
52
52
  if (context instanceof basic_1.UnknownType) {
53
+ /*
53
54
  const message = "Not a structure, type unknown, FieldChain";
54
- input.issues.push((0, _syntax_input_1.syntaxIssue)(input, current.getFirstToken(), message));
55
+ input.issues.push(syntaxIssue(input, current.getFirstToken(), message));
56
+ */
55
57
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
56
58
  }
57
59
  else if (!(context instanceof basic_1.StructureType)
@@ -12,9 +12,10 @@ const component_cond_1 = require("../expressions/component_cond");
12
12
  const dynamic_1 = require("../expressions/dynamic");
13
13
  const loop_group_by_1 = require("../expressions/loop_group_by");
14
14
  const _syntax_input_1 = require("../_syntax_input");
15
+ const version_1 = require("../../../version");
15
16
  class Loop {
16
17
  runSyntax(node, input) {
17
- var _a;
18
+ var _a, _b;
18
19
  const loopTarget = node.findDirectExpression(Expressions.LoopTarget);
19
20
  let target = loopTarget === null || loopTarget === void 0 ? void 0 : loopTarget.findDirectExpression(Expressions.Target);
20
21
  const targetType = target ? target_1.Target.runSyntax(target, input) : undefined;
@@ -64,6 +65,7 @@ class Loop {
64
65
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
65
66
  }
66
67
  const targetConcat = loopTarget === null || loopTarget === void 0 ? void 0 : loopTarget.concatTokens().toUpperCase();
68
+ const topType = sourceType; // todo: refactor topType vs sourceType vs rowType
67
69
  if (sourceType instanceof basic_1.TableType) {
68
70
  rowType = sourceType.getRowType();
69
71
  sourceType = rowType;
@@ -71,6 +73,10 @@ class Loop {
71
73
  sourceType = new basic_1.DataReference(sourceType);
72
74
  }
73
75
  }
76
+ const cond = node.findDirectExpression(Expressions.ComponentCond);
77
+ if (cond !== undefined) {
78
+ component_cond_1.ComponentCond.runSyntax(cond, input, rowType);
79
+ }
74
80
  if (targetConcat
75
81
  && targetConcat.startsWith("TRANSPORTING ")
76
82
  && node.findDirectTokenByText("WHERE") === undefined) {
@@ -78,6 +84,32 @@ class Loop {
78
84
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
79
85
  return;
80
86
  }
87
+ if (node.findDirectTokenByText("USING") !== undefined
88
+ && cond !== undefined
89
+ && topType instanceof basic_1.TableType) {
90
+ // https://github.com/abap2xlsx/abap2xlsx/issues/1341
91
+ const keyName = node.findExpressionAfterToken("KEY");
92
+ let key = undefined;
93
+ if ((keyName === null || keyName === void 0 ? void 0 : keyName.get()) instanceof Expressions.SimpleName) {
94
+ // it might be dynamic, in that case we cannot check anything
95
+ key = (_b = topType.getOptions().secondary) === null || _b === void 0 ? void 0 : _b.find(k => k.name.toUpperCase() === keyName.getFirstToken().getStr().toUpperCase());
96
+ if (key === undefined) {
97
+ const message = "Key " + (keyName === null || keyName === void 0 ? void 0 : keyName.concatTokens()) + " not found in table type";
98
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
99
+ return;
100
+ }
101
+ if (input.scope.getRegistry().getConfig().getVersion() <= version_1.Version.v740sp02) {
102
+ const compares = cond.findAllExpressionsRecursive(Expressions.ComponentCompare).map(c => c.concatTokens().toUpperCase());
103
+ for (const keyField of key.keyFields) {
104
+ if (compares.find(c => c === keyField.toUpperCase() + " IS INITIAL") !== undefined) {
105
+ const message = "Loop, key check with IS INITIAL cannot optimized before 7.40 SP02";
106
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
107
+ return;
108
+ }
109
+ }
110
+ }
111
+ }
112
+ }
81
113
  const inline = target === null || target === void 0 ? void 0 : target.findDirectExpression(Expressions.InlineData);
82
114
  if (inline) {
83
115
  inline_data_1.InlineData.runSyntax(inline, input, sourceType);
@@ -98,9 +130,6 @@ class Loop {
98
130
  fstarget_1.FSTarget.runSyntax(fstarget, input, sourceType);
99
131
  }
100
132
  }
101
- for (const t of node.findDirectExpressions(Expressions.ComponentCond)) {
102
- component_cond_1.ComponentCond.runSyntax(t, input, rowType);
103
- }
104
133
  for (const t of node.findDirectExpressions(Expressions.Dynamic)) {
105
134
  dynamic_1.Dynamic.runSyntax(t, input);
106
135
  }
@@ -7,7 +7,7 @@ class CDSAggregate extends combi_1.Expression {
7
7
  getRunnable() {
8
8
  const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.star)((0, combi_1.seq)(".", _1.CDSName)));
9
9
  const value = (0, combi_1.alt)(name, "*", _1.CDSCast, _1.CDSCase, _1.CDSFunction);
10
- return (0, combi_1.seq)((0, combi_1.alt)("MAX", "MIN", "SUM", "AVG", "COUNT"), "(", (0, combi_1.opt)("DISTINCT"), value, ")");
10
+ return (0, combi_1.seq)((0, combi_1.altPrio)("MAX", "MIN", "SUM", "AVG", "COUNT"), "(", (0, combi_1.opt)("DISTINCT"), value, ")");
11
11
  }
12
12
  }
13
13
  exports.CDSAggregate = CDSAggregate;
@@ -7,7 +7,7 @@ const cds_annotation_simple_1 = require("./cds_annotation_simple");
7
7
  class CDSAnnotationArray extends combi_1.Expression {
8
8
  getRunnable() {
9
9
  const value = (0, combi_1.alt)(cds_annotation_simple_1.CDSAnnotationSimple, _1.CDSAnnotationObject, CDSAnnotationArray);
10
- const valueList = (0, combi_1.seq)("[", value, (0, combi_1.star)((0, combi_1.seq)(",", value)), "]");
10
+ const valueList = (0, combi_1.seq)("[", value, (0, combi_1.starPrio)((0, combi_1.seq)(",", value)), "]");
11
11
  return valueList;
12
12
  }
13
13
  }
@@ -6,7 +6,7 @@ const combi_1 = require("../../abap/2_statements/combi");
6
6
  class CDSCase extends combi_1.Expression {
7
7
  getRunnable() {
8
8
  const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.starPrio)((0, combi_1.seq)(".", _1.CDSName)));
9
- const value = (0, combi_1.altPrio)(_1.CDSFunction, _1.CDSString, CDSCase, _1.CDSCast, _1.CDSArithmetics, name);
9
+ const value = (0, combi_1.altPrio)(_1.CDSString, CDSCase, _1.CDSCast, _1.CDSArithmetics, _1.CDSFunction, name);
10
10
  const thenValue = (0, combi_1.altPrio)((0, combi_1.seq)("(", value, ")"), value);
11
11
  const simple = (0, combi_1.seq)((0, combi_1.altPrio)(_1.CDSFunction, name), (0, combi_1.plusPrio)((0, combi_1.seq)("WHEN", value, "THEN", thenValue)));
12
12
  const complex = (0, combi_1.plusPrio)((0, combi_1.seq)("WHEN", _1.CDSCondition, "THEN", thenValue));
@@ -9,7 +9,7 @@ class CDSDefineCustom extends combi_1.Expression {
9
9
  getRunnable() {
10
10
  const field = (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.str)("KEY")), cds_name_1.CDSName, ":", cds_type_1.CDSType, ";");
11
11
  const compsiOrAssoci = (0, combi_1.seq)(cds_name_1.CDSName, ":", (0, combi_1.alt)(_1.CDSComposition, _1.CDSAssociation), ";");
12
- return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.str)("DEFINE"), (0, combi_1.opt)((0, combi_1.str)("ROOT")), (0, combi_1.str)("CUSTOM ENTITY"), (0, combi_1.opt)(_1.CDSWithParameters), cds_name_1.CDSName, (0, combi_1.str)("{"), (0, combi_1.plus)((0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.alt)(field, compsiOrAssoci))), (0, combi_1.str)("}"), (0, combi_1.opt)(";"));
12
+ return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.str)("DEFINE"), (0, combi_1.opt)((0, combi_1.str)("ROOT")), (0, combi_1.str)("CUSTOM ENTITY"), cds_name_1.CDSName, (0, combi_1.opt)(_1.CDSWithParameters), (0, combi_1.str)("{"), (0, combi_1.plus)((0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.alt)(field, compsiOrAssoci))), (0, combi_1.str)("}"), (0, combi_1.opt)(";"));
13
13
  }
14
14
  }
15
15
  exports.CDSDefineCustom = CDSDefineCustom;
@@ -7,9 +7,9 @@ const cds_as_1 = require("./cds_as");
7
7
  const cds_cast_1 = require("./cds_cast");
8
8
  class CDSElement extends combi_1.Expression {
9
9
  getRunnable() {
10
- const redirected = (0, combi_1.seq)(": REDIRECTED TO", (0, combi_1.opt)((0, combi_1.alt)("PARENT", "COMPOSITION CHILD")), _1.CDSName);
10
+ const redirected = (0, combi_1.seq)(": REDIRECTED TO", (0, combi_1.optPrio)((0, combi_1.altPrio)("PARENT", "COMPOSITION CHILD")), _1.CDSName);
11
11
  const colonThing = (0, combi_1.seq)(":", (0, combi_1.alt)(_1.CDSName, _1.CDSType, "LOCALIZED"));
12
- return (0, combi_1.seq)((0, combi_1.starPrio)(_1.CDSAnnotation), (0, combi_1.optPrio)((0, combi_1.altPrio)("KEY", "VIRTUAL")), (0, combi_1.altPrio)(_1.CDSAggregate, _1.CDSString, _1.CDSArithmetics, _1.CDSFunction, cds_cast_1.CDSCast, _1.CDSCase, (0, combi_1.seq)("(", _1.CDSCase, ")"), (0, combi_1.seq)(_1.CDSPrefixedName, (0, combi_1.opt)(cds_as_1.CDSAs), (0, combi_1.opt)((0, combi_1.alt)(redirected, colonThing))), _1.CDSInteger), (0, combi_1.opt)(cds_as_1.CDSAs));
12
+ return (0, combi_1.seq)((0, combi_1.starPrio)(_1.CDSAnnotation), (0, combi_1.optPrio)((0, combi_1.altPrio)("KEY", "VIRTUAL")), (0, combi_1.altPrio)(_1.CDSAggregate, _1.CDSString, _1.CDSArithmetics, _1.CDSFunction, cds_cast_1.CDSCast, _1.CDSCase, (0, combi_1.seq)("(", _1.CDSCase, ")"), (0, combi_1.seq)(_1.CDSPrefixedName, (0, combi_1.optPrio)(cds_as_1.CDSAs), (0, combi_1.optPrio)((0, combi_1.altPrio)(redirected, colonThing))), _1.CDSInteger), (0, combi_1.optPrio)(cds_as_1.CDSAs));
13
13
  }
14
14
  }
15
15
  exports.CDSElement = CDSElement;
@@ -67,7 +67,7 @@ class Registry {
67
67
  }
68
68
  static abaplintVersion() {
69
69
  // magic, see build script "version.sh"
70
- return "2.113.215";
70
+ return "2.113.217";
71
71
  }
72
72
  getDDICReferences() {
73
73
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.113.215",
3
+ "version": "2.113.217",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",