@abaplint/core 2.113.182 → 2.113.184

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.
@@ -29,7 +29,7 @@ class Source extends combi_1.Expression {
29
29
  const conv = (0, combi_1.ver)(version_1.Version.v740sp02, (0, combi_1.seq)("CONV", _1.TypeNameOrInfer, lparenNoSpace, _1.ConvBody, rparenNoSpace, (0, combi_1.optPrio)(after)), version_1.Version.OpenABAP);
30
30
  const swit = (0, combi_1.ver)(version_1.Version.v740sp02, (0, combi_1.seq)("SWITCH", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), _1.SwitchBody, rparenNoSpace, (0, combi_1.optPrio)(after)));
31
31
  const value = (0, combi_1.ver)(version_1.Version.v740sp02, (0, combi_1.seq)("VALUE", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), _1.ValueBody, rparenNoSpace, (0, combi_1.optPrio)(after)), version_1.Version.OpenABAP);
32
- const cond = (0, combi_1.ver)(version_1.Version.v740sp02, (0, combi_1.seq)("COND", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), _1.CondBody, rparenNoSpace, (0, combi_1.optPrio)(after)));
32
+ const cond = (0, combi_1.ver)(version_1.Version.v740sp02, (0, combi_1.seq)("COND", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), _1.CondBody, rparenNoSpace, (0, combi_1.optPrio)(after)), version_1.Version.OpenABAP);
33
33
  const reff = (0, combi_1.ver)(version_1.Version.v740sp02, (0, combi_1.seq)("REF", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), Source, (0, combi_1.optPrio)("OPTIONAL"), rparen), version_1.Version.OpenABAP);
34
34
  const exact = (0, combi_1.ver)(version_1.Version.v740sp02, (0, combi_1.seq)("EXACT", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), Source, rparen, (0, combi_1.optPrio)(after)));
35
35
  const filter = (0, combi_1.ver)(version_1.Version.v740sp08, (0, combi_1.seq)("FILTER", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), _1.FilterBody, rparen));
@@ -11,7 +11,7 @@ class Raise {
11
11
  const exporting = (0, combi_1.seq)("EXPORTING", expressions_1.ParameterListS);
12
12
  const from = (0, combi_1.seq)("TYPE", expressions_1.ClassName, (0, combi_1.opt)((0, combi_1.alt)((0, combi_1.ver)(version_1.Version.v750, (0, combi_1.alt)(mess, messid)), (0, combi_1.ver)(version_1.Version.v752, "USING MESSAGE"))), (0, combi_1.optPrio)(exporting));
13
13
  const pre = (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.optPrio)("RESUMABLE"), "EXCEPTION"), "SHORTDUMP");
14
- const clas = (0, combi_1.seq)(pre, (0, combi_1.altPrio)(from, (0, combi_1.ver)(version_1.Version.v752, expressions_1.Source), expressions_1.SimpleSource2));
14
+ const clas = (0, combi_1.seq)(pre, (0, combi_1.altPrio)(from, (0, combi_1.ver)(version_1.Version.v752, expressions_1.Source, version_1.Version.OpenABAP), expressions_1.SimpleSource2));
15
15
  const ret = (0, combi_1.seq)("RAISE", (0, combi_1.altPrio)(clas, expressions_1.ExceptionName));
16
16
  return ret;
17
17
  }
@@ -113,7 +113,7 @@ class FieldChain {
113
113
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, current.getFirstToken(), message));
114
114
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
115
115
  }
116
- table_expression_1.TableExpression.runSyntax(current, input);
116
+ table_expression_1.TableExpression.runSyntax(current, input, context);
117
117
  if (!(context instanceof basic_1.VoidType)) {
118
118
  context = context.getRowType();
119
119
  }
@@ -1,16 +1,39 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TableExpression = void 0;
4
+ const nodes_1 = require("../../nodes");
4
5
  const Expressions = require("../../2_statements/expressions");
5
6
  const source_1 = require("./source");
7
+ const basic_1 = require("../../types/basic");
8
+ const component_chain_1 = require("./component_chain");
6
9
  class TableExpression {
7
- static runSyntax(node, input) {
10
+ static runSyntax(node, input, rowType) {
8
11
  if (node === undefined) {
9
12
  return;
10
13
  }
11
- for (const s of node.findDirectExpressions(Expressions.Source)) {
14
+ let context = rowType;
15
+ if (context instanceof basic_1.TableType) {
16
+ context = context.getRowType();
17
+ }
18
+ if (node.getChildren().length === 3) {
19
+ const s = node.findDirectExpression(Expressions.Source);
20
+ source_1.Source.runSyntax(s, input, context);
21
+ }
22
+ else if (node.findDirectTokenByText("INDEX")) {
23
+ const s = node.findDirectExpression(Expressions.Source);
12
24
  source_1.Source.runSyntax(s, input);
13
25
  }
26
+ else {
27
+ let fieldType = undefined;
28
+ for (const c of node.getChildren()) {
29
+ if (c instanceof nodes_1.ExpressionNode && c.get() instanceof Expressions.ComponentChainSimple) {
30
+ fieldType = component_chain_1.ComponentChain.runSyntax(context, c, input);
31
+ }
32
+ else if (c instanceof nodes_1.ExpressionNode && c.get() instanceof Expressions.Source) {
33
+ source_1.Source.runSyntax(c, input, fieldType);
34
+ }
35
+ }
36
+ }
14
37
  }
15
38
  }
16
39
  exports.TableExpression = TableExpression;
@@ -101,7 +101,7 @@ class Target {
101
101
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
102
102
  return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
103
103
  }
104
- table_expression_1.TableExpression.runSyntax(current, input);
104
+ table_expression_1.TableExpression.runSyntax(current, input, context);
105
105
  if (!(context instanceof basic_1.VoidType)) {
106
106
  context = context.getRowType();
107
107
  }
@@ -9,15 +9,22 @@ const _syntax_input_1 = require("../_syntax_input");
9
9
  const assert_error_1 = require("../assert_error");
10
10
  class IncludeType {
11
11
  runSyntax(node, input) {
12
- var _a, _b;
12
+ var _a, _b, _c;
13
13
  const components = [];
14
14
  const iname = node.findFirstExpression(Expressions.TypeName);
15
15
  if (iname === undefined) {
16
16
  throw new assert_error_1.AssertError("IncludeType, unexpected node structure");
17
17
  }
18
18
  const name = iname.getFirstToken().getStr();
19
+ const isStructure = node.findDirectTokenByText("STRUCTURE") !== undefined;
19
20
  let ityp = new basic_types_1.BasicTypes(input).parseType(iname);
20
- const as = (_a = node.findExpressionAfterToken("AS")) === null || _a === void 0 ? void 0 : _a.concatTokens();
21
+ if (ityp instanceof basic_1.VoidType && isStructure) {
22
+ const found = (_a = input.scope.findVariable(name)) === null || _a === void 0 ? void 0 : _a.getType();
23
+ if (found) {
24
+ ityp = found;
25
+ }
26
+ }
27
+ const as = (_b = node.findExpressionAfterToken("AS")) === null || _b === void 0 ? void 0 : _b.concatTokens();
21
28
  if (as && ityp instanceof basic_1.StructureType) {
22
29
  ityp = new basic_1.StructureType(ityp.getComponents().concat([{
23
30
  name: as,
@@ -25,7 +32,18 @@ class IncludeType {
25
32
  asInclude: true,
26
33
  }]));
27
34
  }
28
- const suffix = (_b = node.findExpressionAfterToken("SUFFIX")) === null || _b === void 0 ? void 0 : _b.concatTokens();
35
+ else if (ityp instanceof basic_1.TableType && isStructure) {
36
+ ityp = ityp.getRowType();
37
+ }
38
+ else if (ityp instanceof basic_1.VoidType) {
39
+ return ityp;
40
+ }
41
+ if (!(ityp instanceof basic_1.StructureType)) {
42
+ const message = "not structured, " + name;
43
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, iname.getFirstToken(), message));
44
+ return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
45
+ }
46
+ const suffix = (_c = node.findExpressionAfterToken("SUFFIX")) === null || _c === void 0 ? void 0 : _c.concatTokens();
29
47
  if (suffix && ityp instanceof basic_1.StructureType) {
30
48
  const components = [];
31
49
  for (const c of ityp.getComponents()) {
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Data = void 0;
4
- const _syntax_input_1 = require("../_syntax_input");
5
4
  const data_1 = require("../statements/data");
6
- const _reference_1 = require("../_reference");
7
5
  const nodes_1 = require("../../nodes");
8
6
  const type_1 = require("../statements/type");
9
7
  const _typed_identifier_1 = require("../../types/_typed_identifier");
@@ -12,9 +10,10 @@ const Basic = require("../../types/basic");
12
10
  const Expressions = require("../../2_statements/expressions");
13
11
  const Statements = require("../../2_statements/statements");
14
12
  const Structures = require("../../3_structures/structures");
13
+ const include_type_1 = require("../statements/include_type");
15
14
  class Data {
16
15
  static runSyntax(node, input) {
17
- var _a, _b;
16
+ var _a;
18
17
  const fouth = (_a = node.getFirstChild()) === null || _a === void 0 ? void 0 : _a.getChildren()[3];
19
18
  const isCommonPart = fouth instanceof nodes_1.TokenNode && fouth.concatTokens() === "COMMON";
20
19
  if (isCommonPart) {
@@ -49,25 +48,47 @@ class Data {
49
48
  }
50
49
  else if (c instanceof nodes_1.StatementNode && ctyp instanceof Statements.IncludeType) {
51
50
  // INCLUDES
52
- const typeToken = (_b = c.findFirstExpression(Expressions.TypeName)) === null || _b === void 0 ? void 0 : _b.getFirstToken();
53
- const typeName = typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr();
51
+ /*
52
+ const typeToken = c.findFirstExpression(Expressions.TypeName)?.getFirstToken();
53
+ const typeName = typeToken?.getStr();
54
+
54
55
  let foundId = input.scope.findType(typeName);
55
56
  if (foundId === undefined) {
56
- foundId = input.scope.findVariable(typeName);
57
+ foundId = input.scope.findVariable(typeName);
57
58
  }
58
- let found = foundId === null || foundId === void 0 ? void 0 : foundId.getType();
59
+
60
+ let found = foundId?.getType();
59
61
  if (found === undefined) {
60
- const f = input.scope.getDDIC().lookupTableOrView(typeName).type;
61
- if (f instanceof _typed_identifier_1.TypedIdentifier) {
62
- found = f.getType();
63
- }
64
- else {
65
- found = f;
66
- }
62
+ const f = input.scope.getDDIC().lookupTableOrView(typeName).type;
63
+ if (f instanceof TypedIdentifier) {
64
+ found = f.getType();
65
+ } else {
66
+ found = f;
67
+ }
68
+ } else {
69
+ input.scope.addReference(typeToken, foundId, ReferenceType.TypeReference, input.filename);
70
+ }
71
+ if (found instanceof Basic.VoidType) {
72
+ if (table === true) {
73
+ const ttyp = new Basic.TableType(found, {withHeader: true, keyType: Basic.TableKeyType.default});
74
+ return new TypedIdentifier(name, input.filename, ttyp);
75
+ } else {
76
+ return new TypedIdentifier(name, input.filename, found);
77
+ }
78
+ }
79
+ if (found instanceof Basic.UnknownType) {
80
+ return new TypedIdentifier(name, input.filename, new Basic.UnknownType("unknown type, " + typeName));
81
+ }
82
+ if (found instanceof Basic.TableType && found.isWithHeader()) {
83
+ found = found.getRowType();
67
84
  }
68
- else {
69
- input.scope.addReference(typeToken, foundId, _reference_1.ReferenceType.TypeReference, input.filename);
85
+ if (!(found instanceof Basic.StructureType)) {
86
+ const message = "not structured, " + typeName;
87
+ input.issues.push(syntaxIssue(input, typeToken!, message));
88
+ return new TypedIdentifier(name, input.filename, Basic.VoidType.get(CheckSyntaxKey));
70
89
  }
90
+ */
91
+ const found = new include_type_1.IncludeType().runSyntax(c, input);
71
92
  if (found instanceof Basic.VoidType) {
72
93
  if (table === true) {
73
94
  const ttyp = new Basic.TableType(found, { withHeader: true, keyType: Basic.TableKeyType.default });
@@ -77,18 +98,7 @@ class Data {
77
98
  return new _typed_identifier_1.TypedIdentifier(name, input.filename, found);
78
99
  }
79
100
  }
80
- if (found instanceof Basic.UnknownType) {
81
- return new _typed_identifier_1.TypedIdentifier(name, input.filename, new Basic.UnknownType("unknown type, " + typeName));
82
- }
83
- if (found instanceof Basic.TableType && found.isWithHeader()) {
84
- found = found.getRowType();
85
- }
86
- if (!(found instanceof Basic.StructureType)) {
87
- const message = "not structured, " + typeName;
88
- input.issues.push((0, _syntax_input_1.syntaxIssue)(input, typeToken, message));
89
- return new _typed_identifier_1.TypedIdentifier(name, input.filename, Basic.VoidType.get(_syntax_input_1.CheckSyntaxKey));
90
- }
91
- for (const c of found.getComponents()) {
101
+ for (const c of found) {
92
102
  components.push(c);
93
103
  }
94
104
  }
@@ -67,7 +67,7 @@ class Registry {
67
67
  }
68
68
  static abaplintVersion() {
69
69
  // magic, see build script "version.sh"
70
- return "2.113.182";
70
+ return "2.113.184";
71
71
  }
72
72
  getDDICReferences() {
73
73
  return this.ddicReferences;
@@ -2858,6 +2858,9 @@ ${indentation} output = ${uniqueName}.\n`;
2858
2858
  }
2859
2859
  replaceLineFunctions(node, lowFile, highSyntax, highFile) {
2860
2860
  var _a, _b;
2861
+ if (this.lowReg.getConfig().getVersion() === version_1.Version.OpenABAP) {
2862
+ return undefined;
2863
+ }
2861
2864
  const spag = highSyntax.spaghetti.lookupPosition(node.getFirstToken().getStart(), lowFile.getFilename());
2862
2865
  for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {
2863
2866
  if (r.referenceType !== _reference_1.ReferenceType.BuiltinMethodReference) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.113.182",
3
+ "version": "2.113.184",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",