@abaplint/core 2.113.50 → 2.113.52

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.
@@ -32,7 +32,7 @@ class SelectionScreen {
32
32
  const posIntegers = (0, combi_1.regex)(/^(0?[1-9]|[1234567][0-9]|8[0-3])$/);
33
33
  const pos = (0, combi_1.seq)("POSITION", (0, combi_1.altPrio)(posIntegers, posSymbols));
34
34
  const incl = (0, combi_1.seq)("INCLUDE BLOCKS", expressions_1.BlockName);
35
- const tabbed = (0, combi_1.seq)("BEGIN OF TABBED BLOCK", expressions_1.InlineField, "FOR", expressions_1.Integer, "LINES", (0, combi_1.optPrio)("NO INTERVALS"));
35
+ const tabbed = (0, combi_1.seq)("BEGIN OF TABBED BLOCK", expressions_1.BlockName, "FOR", expressions_1.Integer, "LINES", (0, combi_1.optPrio)("NO INTERVALS"));
36
36
  const uline = (0, combi_1.seq)("ULINE", (0, combi_1.opt)(position));
37
37
  const param = (0, combi_1.seq)("INCLUDE PARAMETERS", expressions_1.Field);
38
38
  const iso = (0, combi_1.seq)("INCLUDE SELECT-OPTIONS", expressions_1.Field);
@@ -35,7 +35,7 @@ class ObjectOriented {
35
35
  return ret;
36
36
  }
37
37
  addAliasedAttributes(classDefinition) {
38
- for (const alias of classDefinition.getAliases()) {
38
+ for (const alias of classDefinition.getAliases() || []) {
39
39
  const comp = alias.getComponent();
40
40
  const idef = this.scope.findInterfaceDefinition(comp.split("~")[0]);
41
41
  if (idef) {
@@ -67,7 +67,7 @@ class ObjectOriented {
67
67
  return undefined;
68
68
  }
69
69
  findMethodViaAlias(methodName, def) {
70
- for (const a of def.getAliases()) {
70
+ for (const a of def.getAliases() || []) {
71
71
  if (a.getName().toUpperCase() === methodName.toUpperCase()) {
72
72
  const comp = a.getComponent();
73
73
  const res = this.findMethodInInterface(comp.split("~")[0], comp.split("~")[1]);
@@ -150,9 +150,12 @@ class ObjectOriented {
150
150
  return undefined;
151
151
  }
152
152
  const upper = name.toUpperCase();
153
- for (const a of def.getAttributes().getAll()) {
154
- if (a.getName().toUpperCase() === upper) {
155
- return a;
153
+ const attr = def.getAttributes();
154
+ if (attr) {
155
+ for (const a of attr.getAll()) {
156
+ if (a.getName().toUpperCase() === upper) {
157
+ return a;
158
+ }
156
159
  }
157
160
  }
158
161
  for (const a of def.getAliases() || []) {
@@ -266,7 +269,11 @@ class ObjectOriented {
266
269
  return { method: undefined, def: undefined };
267
270
  }
268
271
  findMethod(def, methodName) {
269
- for (const method of def.getMethodDefinitions().getAll()) {
272
+ const defs = def.getMethodDefinitions();
273
+ if (defs === undefined) {
274
+ return undefined;
275
+ }
276
+ for (const method of defs.getAll()) {
270
277
  if (method.getName().toUpperCase() === methodName.toUpperCase()) {
271
278
  if (method.isRedefinition()) {
272
279
  return this.findMethodInSuper(def, methodName);
@@ -29,7 +29,7 @@ class Select {
29
29
  const fields = this.findFields(node, input);
30
30
  if (fields.length === 0
31
31
  && node.findDirectExpression(Expressions.SQLFieldListLoop) === undefined) {
32
- const message = `fields missing`;
32
+ const message = `SELECT: fields missing`;
33
33
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
34
34
  return;
35
35
  }
@@ -208,7 +208,7 @@ class Select {
208
208
  const ret = [];
209
209
  expr = node.findFirstExpression(Expressions.SQLFieldList);
210
210
  if (expr === undefined) {
211
- expr = node.findDirectExpression(Expressions.SQLFieldListLoop);
211
+ expr = node.findFirstExpression(Expressions.SQLFieldListLoop);
212
212
  }
213
213
  if (((_a = expr === null || expr === void 0 ? void 0 : expr.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Dynamic) {
214
214
  new dynamic_1.Dynamic().runSyntax(expr.getFirstChild(), input);
@@ -112,7 +112,7 @@ class Source {
112
112
  const foundType = this.determineType(node, input, targetType);
113
113
  const bodyType = new conv_body_1.ConvBody().runSyntax(node.findDirectExpression(Expressions.ConvBody), input);
114
114
  if (new _type_utils_1.TypeUtils(input.scope).isAssignable(foundType, bodyType) === false) {
115
- const message = "CONV: Types not compatible";
115
+ const message = `CONV: Types not compatible, ${foundType === null || foundType === void 0 ? void 0 : foundType.constructor.name}, ${bodyType === null || bodyType === void 0 ? void 0 : bodyType.constructor.name}`;
116
116
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
117
117
  return new basic_1.VoidType(_syntax_input_1.CheckSyntaxKey);
118
118
  }
@@ -20,8 +20,11 @@ class ClassImplementation {
20
20
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
21
21
  return;
22
22
  }
23
- for (const t of classDefinition.getTypeDefinitions().getAll()) {
24
- input.scope.addType(t.type);
23
+ const types = classDefinition.getTypeDefinitions();
24
+ if (types !== undefined) {
25
+ for (const t of types.getAll()) {
26
+ input.scope.addType(t.type);
27
+ }
25
28
  }
26
29
  const sup = input.scope.findClassDefinition(classDefinition.getSuperClass());
27
30
  if (sup) {
@@ -34,10 +37,12 @@ class ClassImplementation {
34
37
  input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(new tokens_1.Identifier(new position_1.Position(1, 1), "me"), _builtin_1.BuiltIn.filename, new basic_1.ObjectReferenceType(classDefinition)));
35
38
  helper.addAliasedAttributes(classDefinition); // todo, this is not correct, take care of instance vs static
36
39
  const classAttributes = classDefinition.getAttributes();
37
- input.scope.addList(classAttributes.getConstants());
38
- input.scope.addList(classAttributes.getStatic());
39
- for (const i of classAttributes.getInstance()) {
40
- input.scope.addExtraLikeType(i);
40
+ if (classAttributes !== undefined) {
41
+ input.scope.addList(classAttributes.getConstants());
42
+ input.scope.addList(classAttributes.getStatic());
43
+ for (const i of classAttributes.getInstance()) {
44
+ input.scope.addExtraLikeType(i);
45
+ }
41
46
  }
42
47
  helper.fromSuperClassesAndInterfaces(classDefinition);
43
48
  }
@@ -7,30 +7,35 @@ const basic_1 = require("../../types/basic");
7
7
  const _syntax_input_1 = require("../_syntax_input");
8
8
  class SelectionScreen {
9
9
  runSyntax(node, input) {
10
- const field = node.findFirstExpression(Expressions.InlineField);
11
- if (field === undefined) {
10
+ const blockNode = node.findFirstExpression(Expressions.BlockName);
11
+ const blockToken = blockNode === null || blockNode === void 0 ? void 0 : blockNode.getFirstToken();
12
+ const blockName = blockNode === null || blockNode === void 0 ? void 0 : blockNode.concatTokens();
13
+ if (blockName !== undefined && blockName.length > 16) {
14
+ const message = "SELECTION-SCREEN block name too long, " + blockName;
15
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
12
16
  return;
13
17
  }
14
- if (field.getFirstToken().getStr().length > 8) {
18
+ const field = node.findFirstExpression(Expressions.InlineField);
19
+ if (field !== undefined && field.getFirstToken().getStr().length > 8) {
15
20
  const message = "SELECTION-SCREEN name too long, " + field.getFirstToken().getStr();
16
21
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, field.getFirstToken(), message));
17
22
  return;
18
23
  }
19
- const name = field.getFirstToken();
24
+ const fieldName = field === null || field === void 0 ? void 0 : field.getFirstToken();
20
25
  const concat = node.concatTokens().toUpperCase();
21
- if (concat.includes("BEGIN OF TABBED BLOCK")) {
26
+ if (concat.includes("BEGIN OF TABBED BLOCK") && blockToken) {
22
27
  const type = new basic_1.StructureType([
23
28
  { name: "PROG", type: new basic_1.CharacterType(40) },
24
29
  { name: "DYNNR", type: new basic_1.CharacterType(4) },
25
30
  { name: "ACTIVETAB", type: new basic_1.CharacterType(132) },
26
31
  ]);
27
- input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(name, input.filename, type, ["selection_screen_tab" /* IdentifierMeta.SelectionScreenTab */]));
32
+ input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(blockToken, input.filename, type, ["selection_screen_tab" /* IdentifierMeta.SelectionScreenTab */]));
28
33
  }
29
- else if (concat.startsWith("SELECTION-SCREEN TAB")) {
30
- input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(name, input.filename, new basic_1.CharacterType(83), ["selection_screen_tab" /* IdentifierMeta.SelectionScreenTab */]));
34
+ else if (concat.startsWith("SELECTION-SCREEN TAB") && fieldName) {
35
+ input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(fieldName, input.filename, new basic_1.CharacterType(83), ["selection_screen_tab" /* IdentifierMeta.SelectionScreenTab */]));
31
36
  }
32
- else {
33
- input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(name, input.filename, new basic_1.CharacterType(83)));
37
+ else if (fieldName) {
38
+ input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(fieldName, input.filename, new basic_1.CharacterType(83)));
34
39
  }
35
40
  }
36
41
  }
@@ -7,7 +7,7 @@ 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
- return (0, combi_1.seq)((0, combi_1.starPrio)(_1.CDSAnnotation), (0, combi_1.optPrio)("KEY"), (0, combi_1.altPrio)(_1.CDSAggregate, _1.CDSString, _1.CDSFunction, _1.CDSArithmetics, cds_cast_1.CDSCast, _1.CDSCase, (0, combi_1.seq)(_1.CDSName, ": REDIRECTED TO", (0, combi_1.opt)((0, combi_1.alt)("PARENT", "COMPOSITION CHILD")), _1.CDSName), _1.CDSPrefixedName, (0, combi_1.regex)(/^\d+$/)), (0, combi_1.opt)(cds_as_1.CDSAs));
10
+ return (0, combi_1.seq)((0, combi_1.starPrio)(_1.CDSAnnotation), (0, combi_1.optPrio)("KEY"), (0, combi_1.altPrio)(_1.CDSAggregate, _1.CDSString, _1.CDSArithmetics, _1.CDSFunction, cds_cast_1.CDSCast, _1.CDSCase, (0, combi_1.seq)(_1.CDSName, ": REDIRECTED TO", (0, combi_1.opt)((0, combi_1.alt)("PARENT", "COMPOSITION CHILD")), _1.CDSName), _1.CDSPrefixedName, (0, combi_1.regex)(/^\d+$/)), (0, combi_1.opt)(cds_as_1.CDSAs));
11
11
  }
12
12
  }
13
13
  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.50";
70
+ return "2.113.52";
71
71
  }
72
72
  getDDICReferences() {
73
73
  return this.ddicReferences;
@@ -95,7 +95,11 @@ class SelectionScreenNaming extends _abap_rule_1.ABAPRule {
95
95
  return statNode.findFirstExpression(expressions_1.FieldSub);
96
96
  }
97
97
  else if (statNode.get() instanceof statements_1.SelectionScreen) {
98
- return statNode.findFirstExpression(expressions_1.InlineField);
98
+ let ret = statNode.findFirstExpression(expressions_1.InlineField);
99
+ if (ret === undefined && statNode.concatTokens().toUpperCase().includes(" BEGIN OF TABBED BLOCK")) {
100
+ ret = statNode.findFirstExpression(expressions_1.BlockName);
101
+ }
102
+ return ret;
99
103
  }
100
104
  else {
101
105
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.113.50",
3
+ "version": "2.113.52",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",