@abaplint/core 2.113.127 → 2.113.129

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 @@ class Color extends combi_1.Expression {
8
8
  const eq = (0, combi_1.seq)("=", source_1.Source);
9
9
  const integers = (0, combi_1.altPrio)("1", "2", "3", "4", "5", "6", "7");
10
10
  const texts = (0, combi_1.altPrio)("COL_BACKGROUND", "COL_HEADING", "COL_NORMAL", "COL_TOTAL", "COL_KEY", "COL_POSITIVE", "COL_NEGATIVE", "COL_GROUP");
11
- const value = (0, combi_1.alt)(eq, (0, combi_1.altPrio)("ON", "OFF", (0, combi_1.altPrio)(integers, texts)));
11
+ const value = (0, combi_1.alt)(eq, (0, combi_1.altPrio)("ON", "OFF", "COLOR OFF", (0, combi_1.altPrio)(integers, texts)));
12
12
  const toggle = (0, combi_1.altPrio)("ON", "OFF");
13
13
  return (0, combi_1.seq)("COLOR", (0, combi_1.opt)((0, combi_1.seq)(value, (0, combi_1.opt)(toggle))));
14
14
  }
@@ -6,8 +6,8 @@ const expressions_1 = require("../expressions");
6
6
  class DataBegin {
7
7
  getMatcher() {
8
8
  const occurs = (0, combi_1.seq)("OCCURS", expressions_1.Integer);
9
- const common = (0, combi_1.altPrio)((0, combi_1.seq)("COMMON PART", expressions_1.DefinitionName), "COMMON PART");
10
- const structure = (0, combi_1.seq)("BEGIN OF", (0, combi_1.altPrio)(common, (0, combi_1.seq)(expressions_1.DefinitionName, (0, combi_1.opt)("READ-ONLY"), (0, combi_1.opt)(occurs))));
9
+ const common = (0, combi_1.seq)("COMMON PART", (0, combi_1.optPrio)(expressions_1.DefinitionName));
10
+ const structure = (0, combi_1.seq)("BEGIN OF", (0, combi_1.altPrio)(common, (0, combi_1.seq)(expressions_1.DefinitionName, (0, combi_1.optPrio)("READ-ONLY"), (0, combi_1.optPrio)(occurs))));
11
11
  return (0, combi_1.seq)("DATA", structure);
12
12
  }
13
13
  }
@@ -5,7 +5,7 @@ const Structures = require("./");
5
5
  const _combi_1 = require("./_combi");
6
6
  class DynproLogic {
7
7
  getMatcher() {
8
- return (0, _combi_1.seq)((0, _combi_1.sub)(Structures.ProcessBeforeOutput), (0, _combi_1.sub)(Structures.ProcessAfterInput), (0, _combi_1.opt)((0, _combi_1.sub)(Structures.ProcessOnValueRequest)), (0, _combi_1.opt)((0, _combi_1.sub)(Structures.ProcessOnHelpRequest)));
8
+ return (0, _combi_1.seq)((0, _combi_1.sub)(Structures.ProcessBeforeOutput), (0, _combi_1.sub)(Structures.ProcessAfterInput), (0, _combi_1.opt)((0, _combi_1.sub)(Structures.ProcessOnHelpRequest)), (0, _combi_1.opt)((0, _combi_1.sub)(Structures.ProcessOnValueRequest)), (0, _combi_1.opt)((0, _combi_1.sub)(Structures.ProcessOnHelpRequest)));
9
9
  }
10
10
  }
11
11
  exports.DynproLogic = DynproLogic;
@@ -6,7 +6,7 @@ const _combi_1 = require("./_combi");
6
6
  const chain_1 = require("./chain");
7
7
  class DynproLoop {
8
8
  getMatcher() {
9
- return (0, _combi_1.beginEnd)((0, _combi_1.sta)(Statements.DynproLoop), (0, _combi_1.star)((0, _combi_1.alt)((0, _combi_1.sta)(Statements.Module), (0, _combi_1.sub)(chain_1.Chain))), (0, _combi_1.sta)(Statements.EndLoop));
9
+ return (0, _combi_1.beginEnd)((0, _combi_1.sta)(Statements.DynproLoop), (0, _combi_1.star)((0, _combi_1.alt)((0, _combi_1.sta)(Statements.Module), (0, _combi_1.sta)(Statements.Field), (0, _combi_1.sub)(chain_1.Chain))), (0, _combi_1.sta)(Statements.EndLoop));
10
10
  }
11
11
  }
12
12
  exports.DynproLoop = DynproLoop;
@@ -524,6 +524,9 @@ class TypeUtils {
524
524
  else if ((target instanceof basic_1.StringType || target instanceof basic_1.CharacterType)
525
525
  && source instanceof basic_1.StructureType
526
526
  && this.isCharLike(source)) {
527
+ if (this.structureContainsString(source) === true) {
528
+ return false;
529
+ }
527
530
  return true;
528
531
  }
529
532
  else if (source instanceof basic_1.StructureType) {
@@ -15,8 +15,7 @@ class AttributeChain {
15
15
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), "Not an object reference(AttributeChain)"));
16
16
  return void_type_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
17
17
  }
18
- const children = node.getChildren().slice();
19
- const first = children[0];
18
+ const first = node.getChildren()[0];
20
19
  if (!(first.get() instanceof expressions_1.AttributeName)) {
21
20
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), "AttributeChain, unexpected first child"));
22
21
  return void_type_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
@@ -18,23 +18,25 @@ class MethodCallChain {
18
18
  static runSyntax(node, input, targetType) {
19
19
  var _a, _b;
20
20
  const helper = new _object_oriented_1.ObjectOriented(input.scope);
21
- const children = node.getChildren().slice();
22
- const first = children.shift();
21
+ const children = node.getChildren();
22
+ const first = children[0];
23
23
  if (first === undefined) {
24
24
  const message = "MethodCallChain, first child expected";
25
25
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
26
26
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
27
27
  }
28
+ let currentIndex = 1;
28
29
  let context = this.findTop(first, input, targetType);
29
30
  if (first.get() instanceof Expressions.MethodCall) {
30
- children.unshift(first);
31
+ currentIndex--;
31
32
  }
32
33
  let previous = undefined;
33
- while (children.length > 0) {
34
- const current = children.shift();
34
+ while (currentIndex <= children.length) {
35
+ const current = children[currentIndex];
35
36
  if (current === undefined) {
36
37
  break;
37
38
  }
39
+ currentIndex++;
38
40
  if (current instanceof nodes_1.ExpressionNode && current.get() instanceof Expressions.MethodCall) {
39
41
  // for built-in methods set className to undefined
40
42
  const className = context instanceof basic_1.ObjectReferenceType ? context.getIdentifierName() : undefined;
@@ -189,46 +189,49 @@ class Source {
189
189
  let hexExpected = false;
190
190
  let hexNext = false;
191
191
  while (children.length >= 0) {
192
- if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.MethodCallChain) {
193
- context = method_call_chain_1.MethodCallChain.runSyntax(first, input, targetType);
194
- if (context === undefined) {
195
- const message = "Method has no RETURNING value";
196
- input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
197
- return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
192
+ if (first instanceof nodes_1.ExpressionNode) {
193
+ const get = first.get();
194
+ if (get instanceof Expressions.MethodCallChain) {
195
+ context = method_call_chain_1.MethodCallChain.runSyntax(first, input, targetType);
196
+ if (context === undefined) {
197
+ const message = "Method has no RETURNING value";
198
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
199
+ return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
200
+ }
198
201
  }
199
- }
200
- else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.FieldChain) {
201
- context = field_chain_1.FieldChain.runSyntax(first, input, type);
202
- }
203
- else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.StringTemplate) {
204
- context = string_template_1.StringTemplate.runSyntax(first, input);
205
- }
206
- else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.Source) {
207
- const found = Source.runSyntax(first, input);
208
- context = this.infer(context, found);
209
- }
210
- else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.Constant) {
211
- const found = constant_1.Constant.runSyntax(first);
212
- context = this.infer(context, found);
213
- }
214
- else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.Dereference) {
215
- context = dereference_1.Dereference.runSyntax(first, context, input);
216
- }
217
- else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.ComponentChain) {
218
- context = component_chain_1.ComponentChain.runSyntax(context, first, input);
219
- }
220
- else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.ArithOperator) {
221
- if (first.concatTokens() === "**") {
222
- context = new basic_1.FloatType();
202
+ else if (get instanceof Expressions.FieldChain) {
203
+ context = field_chain_1.FieldChain.runSyntax(first, input, type);
223
204
  }
224
- const operator = first.concatTokens().toUpperCase();
225
- if (operator === "BIT-OR" || operator === "BIT-AND" || operator === "BIT-XOR") {
226
- hexExpected = true;
227
- hexNext = true;
205
+ else if (get instanceof Expressions.StringTemplate) {
206
+ context = string_template_1.StringTemplate.runSyntax(first, input);
207
+ }
208
+ else if (get instanceof Expressions.Source) {
209
+ const found = Source.runSyntax(first, input);
210
+ context = this.infer(context, found);
211
+ }
212
+ else if (get instanceof Expressions.Constant) {
213
+ const found = constant_1.Constant.runSyntax(first);
214
+ context = this.infer(context, found);
215
+ }
216
+ else if (get instanceof Expressions.Dereference) {
217
+ context = dereference_1.Dereference.runSyntax(first, context, input);
218
+ }
219
+ else if (get instanceof Expressions.ComponentChain) {
220
+ context = component_chain_1.ComponentChain.runSyntax(context, first, input);
221
+ }
222
+ else if (get instanceof Expressions.ArithOperator) {
223
+ if (first.concatTokens() === "**") {
224
+ context = new basic_1.FloatType();
225
+ }
226
+ const operator = first.concatTokens().toUpperCase();
227
+ if (operator === "BIT-OR" || operator === "BIT-AND" || operator === "BIT-XOR") {
228
+ hexExpected = true;
229
+ hexNext = true;
230
+ }
231
+ }
232
+ else if (get instanceof Expressions.AttributeChain) {
233
+ context = attribute_chain_1.AttributeChain.runSyntax(context, first, input, type);
228
234
  }
229
- }
230
- else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.AttributeChain) {
231
- context = attribute_chain_1.AttributeChain.runSyntax(context, first, input, type);
232
235
  }
233
236
  if (hexExpected === true) {
234
237
  if (!(context instanceof basic_1.VoidType)
@@ -273,7 +276,7 @@ class Source {
273
276
  }
274
277
  static addIfInferred(node, input, inferredType) {
275
278
  const basic = new basic_types_1.BasicTypes(input);
276
- const typeExpression = node.findFirstExpression(Expressions.TypeNameOrInfer);
279
+ const typeExpression = node.findDirectExpression(Expressions.TypeNameOrInfer);
277
280
  const typeToken = typeExpression === null || typeExpression === void 0 ? void 0 : typeExpression.getFirstToken();
278
281
  const typeName = typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr();
279
282
  if (typeName === "#" && inferredType && typeToken) {
@@ -297,7 +300,7 @@ class Source {
297
300
  }
298
301
  static determineType(node, input, targetType) {
299
302
  const basic = new basic_types_1.BasicTypes(input);
300
- const typeExpression = node.findFirstExpression(Expressions.TypeNameOrInfer);
303
+ const typeExpression = node.findDirectExpression(Expressions.TypeNameOrInfer);
301
304
  const typeToken = typeExpression === null || typeExpression === void 0 ? void 0 : typeExpression.getFirstToken();
302
305
  const typeName = typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr();
303
306
  if (typeExpression === undefined) {
@@ -26,8 +26,8 @@ class Target {
26
26
  return found.getType();
27
27
  }
28
28
  }
29
- const children = node.getChildren().slice();
30
- const first = children.shift();
29
+ const children = node.getChildren();
30
+ const first = children[0];
31
31
  if (first === undefined || !(first instanceof nodes_1.ExpressionNode)) {
32
32
  return undefined;
33
33
  }
@@ -37,11 +37,13 @@ class Target {
37
37
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
38
38
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
39
39
  }
40
- while (children.length > 0) {
41
- const current = children.shift();
40
+ let currentIndex = 1;
41
+ while (currentIndex <= children.length) {
42
+ const current = children[currentIndex];
42
43
  if (current === undefined) {
43
44
  break;
44
45
  }
46
+ currentIndex++;
45
47
  if (current.get() instanceof tokens_1.Dash) {
46
48
  if (context instanceof unknown_type_1.UnknownType) {
47
49
  const message = "Not a structure, type unknown, target";
@@ -1,18 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Data = void 0;
4
- const Expressions = require("../../2_statements/expressions");
5
- const Statements = require("../../2_statements/statements");
6
- const Structures = require("../../3_structures/structures");
4
+ const _syntax_input_1 = require("../_syntax_input");
5
+ const data_1 = require("../statements/data");
6
+ const _reference_1 = require("../_reference");
7
7
  const nodes_1 = require("../../nodes");
8
+ const type_1 = require("../statements/type");
8
9
  const _typed_identifier_1 = require("../../types/_typed_identifier");
10
+ const types_1 = require("./types");
9
11
  const Basic = require("../../types/basic");
10
- const data_1 = require("../statements/data");
11
- const _reference_1 = require("../_reference");
12
- const _syntax_input_1 = require("../_syntax_input");
12
+ const Expressions = require("../../2_statements/expressions");
13
+ const Statements = require("../../2_statements/statements");
14
+ const Structures = require("../../3_structures/structures");
13
15
  class Data {
14
- runSyntax(node, input) {
15
- var _a;
16
+ static runSyntax(node, input) {
17
+ var _a, _b;
18
+ const fouth = (_a = node.getFirstChild()) === null || _a === void 0 ? void 0 : _a.getChildren()[3];
19
+ const isCommonPart = fouth instanceof nodes_1.TokenNode && fouth.concatTokens() === "COMMON";
20
+ if (isCommonPart) {
21
+ this.runCommonPartSyntax(node, input);
22
+ return undefined;
23
+ }
16
24
  const name = node.findFirstExpression(Expressions.DefinitionName).getFirstToken();
17
25
  let table = false;
18
26
  const values = {};
@@ -29,7 +37,7 @@ class Data {
29
37
  }
30
38
  }
31
39
  else if (c instanceof nodes_1.StructureNode && ctyp instanceof Structures.Data) {
32
- const found = new Data().runSyntax(c, input);
40
+ const found = Data.runSyntax(c, input);
33
41
  if (found) {
34
42
  components.push({ name: found.getName(), type: found.getType() });
35
43
  }
@@ -41,7 +49,7 @@ class Data {
41
49
  }
42
50
  else if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.IncludeType) {
43
51
  // INCLUDES
44
- const typeToken = (_a = c.findFirstExpression(Expressions.TypeName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
52
+ const typeToken = (_b = c.findFirstExpression(Expressions.TypeName)) === null || _b === void 0 ? void 0 : _b.getFirstToken();
45
53
  const typeName = typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr();
46
54
  let foundId = input.scope.findType(typeName);
47
55
  if (foundId === undefined) {
@@ -93,6 +101,35 @@ class Data {
93
101
  return new _typed_identifier_1.TypedIdentifier(name, input.filename, new Basic.StructureType(components), undefined, val);
94
102
  }
95
103
  }
104
+ static runCommonPartSyntax(node, input) {
105
+ for (const c of node.getChildren()) {
106
+ const ctyp = c.get();
107
+ if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.Data) {
108
+ const found = new data_1.Data().runSyntax(c, input);
109
+ if (found) {
110
+ input.scope.addIdentifier(found);
111
+ }
112
+ }
113
+ else if (c instanceof nodes_1.StructureNode && ctyp instanceof Structures.Data) {
114
+ const found = Data.runSyntax(c, input);
115
+ if (found) {
116
+ input.scope.addIdentifier(found);
117
+ }
118
+ }
119
+ else if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.Type) {
120
+ const found = new type_1.Type().runSyntax(c, input);
121
+ if (found) {
122
+ input.scope.addIdentifier(found);
123
+ }
124
+ }
125
+ else if (c instanceof nodes_1.StructureNode && ctyp instanceof Structures.Types) {
126
+ const found = new types_1.Types().runSyntax(c, input);
127
+ if (found) {
128
+ input.scope.addIdentifier(found);
129
+ }
130
+ }
131
+ }
132
+ }
96
133
  }
97
134
  exports.Data = Data;
98
135
  //# sourceMappingURL=data.js.map
@@ -410,7 +410,7 @@ class SyntaxLogic {
410
410
  return true;
411
411
  }
412
412
  else if (stru instanceof Structures.Data) {
413
- this.scope.addIdentifier(new data_1.Data().runSyntax(node, input));
413
+ this.scope.addIdentifier(data_1.Data.runSyntax(node, input));
414
414
  return true;
415
415
  }
416
416
  else if (stru instanceof Structures.Statics) {
@@ -123,7 +123,7 @@ class Attributes {
123
123
  const ctyp = c.get();
124
124
  if (c instanceof nodes_1.StructureNode) {
125
125
  if (ctyp instanceof Structures.Data) {
126
- const found = new data_2.Data().runSyntax(c, input);
126
+ const found = data_2.Data.runSyntax(c, input);
127
127
  if (found !== undefined) {
128
128
  const attr = new class_attribute_1.ClassAttribute(found, visibility, found.getMeta(), found.getValue());
129
129
  this.instance.push(attr);
@@ -67,7 +67,7 @@ class Registry {
67
67
  }
68
68
  static abaplintVersion() {
69
69
  // magic, see build script "version.sh"
70
- return "2.113.127";
70
+ return "2.113.129";
71
71
  }
72
72
  getDDICReferences() {
73
73
  return this.ddicReferences;
@@ -1239,7 +1239,8 @@ ${indentation}${uniqueName1}-attr3 = 'IF_T100_DYN_MSG~MSGV3'.
1239
1239
  ${indentation}${uniqueName1}-attr4 = 'IF_T100_DYN_MSG~MSGV4'.\n`;
1240
1240
  }
1241
1241
  abap += `${indentation}DATA ${uniqueName2} TYPE REF TO ${className}.
1242
- ${indentation}CREATE OBJECT ${uniqueName2} EXPORTING textid = ${uniqueName1}.\n`;
1242
+ ${indentation}CREATE OBJECT ${uniqueName2}.
1243
+ ${indentation}${uniqueName2}->if_t100_message~t100key = ${uniqueName1}.\n`;
1243
1244
  if (withs.length > 0) {
1244
1245
  abap += `${indentation}${uniqueName2}->if_t100_dyn_msg~msgty = 'E'.\n`;
1245
1246
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.113.127",
3
+ "version": "2.113.129",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -53,9 +53,9 @@
53
53
  "@microsoft/api-extractor": "^7.52.8",
54
54
  "@types/chai": "^4.3.20",
55
55
  "@types/mocha": "^10.0.10",
56
- "@types/node": "^24.0.0",
56
+ "@types/node": "^24.0.1",
57
57
  "chai": "^4.5.0",
58
- "eslint": "^9.28.0",
58
+ "eslint": "^9.29.0",
59
59
  "mocha": "^11.6.0",
60
60
  "c8": "^10.1.3",
61
61
  "source-map-support": "^0.5.21",