@abaplint/core 2.91.39 → 2.92.2

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.
@@ -2002,6 +2002,7 @@ declare namespace Expressions {
2002
2002
  TypeTableKey,
2003
2003
  TypeTable,
2004
2004
  Type_2 as Type,
2005
+ ValueBodyLine,
2005
2006
  ValueBodyLines,
2006
2007
  ValueBody,
2007
2008
  Value,
@@ -2782,9 +2783,12 @@ declare interface IFunctionModuleParameter {
2782
2783
  declare interface IGlobalConfig {
2783
2784
  /** input files, glob format */
2784
2785
  files: string;
2786
+ skipGeneratedBOPFInterfaces?: boolean;
2787
+ skipGeneratedFunctionGroups?: boolean;
2785
2788
  skipGeneratedGatewayClasses?: boolean;
2786
2789
  skipGeneratedPersistentClasses?: boolean;
2787
- skipGeneratedFunctionGroups?: boolean;
2790
+ skipGeneratedProxyClasses?: boolean;
2791
+ skipGeneratedProxyInterfaces?: boolean;
2788
2792
  /** Clone and parse dependencies specified in .apack-manifest.xml if it is present */
2789
2793
  useApackDependencies?: boolean;
2790
2794
  /** Do not report any issues for includes without main programs */
@@ -6103,6 +6107,10 @@ declare class ValueBody extends Expression {
6103
6107
  getRunnable(): IStatementRunnable;
6104
6108
  }
6105
6109
 
6110
+ declare class ValueBodyLine extends Expression {
6111
+ getRunnable(): IStatementRunnable;
6112
+ }
6113
+
6106
6114
  declare class ValueBodyLines extends Expression {
6107
6115
  getRunnable(): IStatementRunnable;
6108
6116
  }
@@ -210,6 +210,7 @@ __exportStar(require("./type_param"), exports);
210
210
  __exportStar(require("./type_table_key"), exports);
211
211
  __exportStar(require("./type_table"), exports);
212
212
  __exportStar(require("./type"), exports);
213
+ __exportStar(require("./value_body_line"), exports);
213
214
  __exportStar(require("./value_body_lines"), exports);
214
215
  __exportStar(require("./value_body"), exports);
215
216
  __exportStar(require("./value"), exports);
@@ -2,16 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ValueBody = void 0;
4
4
  const combi_1 = require("../combi");
5
- const tokens_1 = require("../../1_lexer/tokens");
6
5
  const _1 = require(".");
7
6
  const version_1 = require("../../../version");
8
- const value_body_lines_1 = require("./value_body_lines");
9
7
  class ValueBody extends combi_1.Expression {
10
8
  getRunnable() {
11
9
  const base = (0, combi_1.seq)("BASE", _1.Source);
12
- // missing spaces caught by rule "parser_missing_space"
13
- const foo = (0, combi_1.seq)((0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeft)), (0, combi_1.optPrio)((0, combi_1.altPrio)((0, combi_1.plusPrio)(_1.FieldAssignment), value_body_lines_1.ValueBodyLines, _1.Source)), (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenRightW), (0, combi_1.tok)(tokens_1.ParenRightW)));
14
- const strucOrTab = (0, combi_1.seq)((0, combi_1.optPrio)(_1.Let), (0, combi_1.optPrio)(base), (0, combi_1.star)(_1.For), (0, combi_1.plusPrio)((0, combi_1.altPrio)(_1.FieldAssignment, foo)));
10
+ const strucOrTab = (0, combi_1.seq)((0, combi_1.optPrio)(_1.Let), (0, combi_1.optPrio)(base), (0, combi_1.star)(_1.For), (0, combi_1.plusPrio)((0, combi_1.altPrio)(_1.FieldAssignment, _1.ValueBodyLine)));
15
11
  const tabdef = (0, combi_1.ver)(version_1.Version.v740sp08, (0, combi_1.altPrio)("OPTIONAL", (0, combi_1.seq)("DEFAULT", _1.Source)));
16
12
  return (0, combi_1.optPrio)((0, combi_1.altPrio)(strucOrTab, (0, combi_1.seq)(_1.Source, (0, combi_1.optPrio)(tabdef))));
17
13
  }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ValueBodyLine = void 0;
4
+ const combi_1 = require("../combi");
5
+ const tokens_1 = require("../../1_lexer/tokens");
6
+ const _1 = require(".");
7
+ const value_body_lines_1 = require("./value_body_lines");
8
+ class ValueBodyLine extends combi_1.Expression {
9
+ getRunnable() {
10
+ // missing spaces caught by rule "parser_missing_space"
11
+ const ret = (0, combi_1.seq)((0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.tok)(tokens_1.WParenLeft)), (0, combi_1.optPrio)((0, combi_1.altPrio)((0, combi_1.plusPrio)(_1.FieldAssignment), value_body_lines_1.ValueBodyLines, _1.Source)), (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenRightW), (0, combi_1.tok)(tokens_1.ParenRightW)));
12
+ return ret;
13
+ }
14
+ }
15
+ exports.ValueBodyLine = ValueBodyLine;
16
+ //# sourceMappingURL=value_body_line.js.map
@@ -87,7 +87,8 @@ class Procedural {
87
87
  else {
88
88
  found = ddic.lookup(param.type).type;
89
89
  }
90
- if (param.direction === types_1.FunctionModuleParameterDirection.tables) {
90
+ if (param.direction === types_1.FunctionModuleParameterDirection.tables
91
+ && !(found instanceof basic_1.TableType)) {
91
92
  found = new basic_1.TableType(found, { withHeader: true });
92
93
  }
93
94
  if (found instanceof basic_1.UnknownType && ((_a = param.type) === null || _a === void 0 ? void 0 : _a.includes("-"))) {
@@ -27,8 +27,16 @@ class ValueBody {
27
27
  for (const s of node.findDirectExpressions(Expressions.Source)) {
28
28
  type = new source_1.Source().runSyntax(s, scope, filename);
29
29
  }
30
- for (const l of node.findDirectExpressions(Expressions.ValueBodyLines)) {
31
- for (const s of l.findDirectExpressions(Expressions.Source)) {
30
+ for (const foo of node.findDirectExpressions(Expressions.ValueBodyLine)) {
31
+ for (const l of foo.findDirectExpressions(Expressions.ValueBodyLines)) {
32
+ for (const s of l.findDirectExpressions(Expressions.Source)) {
33
+ new source_1.Source().runSyntax(s, scope, filename);
34
+ }
35
+ }
36
+ for (const s of foo.findDirectExpressions(Expressions.FieldAssignment)) {
37
+ new field_assignment_1.FieldAssignment().runSyntax(s, scope, filename, targetType);
38
+ }
39
+ for (const s of foo.findDirectExpressions(Expressions.Source)) {
32
40
  new source_1.Source().runSyntax(s, scope, filename);
33
41
  }
34
42
  }
@@ -74,7 +74,8 @@ class FunctionModuleDefinition {
74
74
  this.parameters.push({
75
75
  name: param.PARAMETER,
76
76
  direction: FunctionModuleParameterDirection.tables,
77
- type: param.DBSTRUCT,
77
+ // table types are stored in TYP
78
+ type: param.DBSTRUCT || param.TYP,
78
79
  });
79
80
  }
80
81
  }
@@ -42,14 +42,19 @@ class Config {
42
42
  if (ver) {
43
43
  version = ver;
44
44
  }
45
+ // defaults: dont skip anything, report everything. The user can decide to skip stuff
46
+ // its difficult to debug errors not being reported
45
47
  const config = {
46
48
  global: {
47
49
  files: "/src/**/*.*",
48
50
  exclude: [],
49
51
  noIssues: [],
50
- skipGeneratedGatewayClasses: true,
51
- skipGeneratedPersistentClasses: true,
52
- skipGeneratedFunctionGroups: true,
52
+ skipGeneratedBOPFInterfaces: false,
53
+ skipGeneratedFunctionGroups: false,
54
+ skipGeneratedGatewayClasses: false,
55
+ skipGeneratedPersistentClasses: false,
56
+ skipGeneratedProxyClasses: false,
57
+ skipGeneratedProxyInterfaces: false,
53
58
  useApackDependencies: false,
54
59
  skipIncludesWithoutMain: false,
55
60
  },
@@ -34,7 +34,7 @@ class DataElement extends _abstract_object_1.AbstractObject {
34
34
  parseType(reg) {
35
35
  const references = [];
36
36
  let lookup = undefined;
37
- if (this.parsedXML === undefined || this.parsedXML === {}) {
37
+ if (this.parsedXML === undefined) {
38
38
  lookup = { type: new Types.UnknownType("Data Element " + this.getName() + ", parser error") };
39
39
  }
40
40
  else {
@@ -32,7 +32,7 @@ class TableType extends _abstract_object_1.AbstractObject {
32
32
  const ddic = new ddic_1.DDIC(reg);
33
33
  const references = [];
34
34
  let type;
35
- if (this.parsedXML === undefined || this.parsedXML === {}) {
35
+ if (this.parsedXML === undefined) {
36
36
  type = new Types.UnknownType("Table Type, parser error", this.getName());
37
37
  }
38
38
  else if (this.parsedXML.rowkind === "S") {
@@ -67,7 +67,7 @@ class Registry {
67
67
  }
68
68
  static abaplintVersion() {
69
69
  // magic, see build script "version.sh"
70
- return "2.91.39";
70
+ return "2.92.2";
71
71
  }
72
72
  getDDICReferences() {
73
73
  return this.references;
@@ -56,7 +56,13 @@ foobar( moo = 1
56
56
 
57
57
  foo = VALUE #(
58
58
  foo = bar
59
- moo = 2 ).`,
59
+ moo = 2 ).
60
+
61
+ DATA(sdf) = VALUE type(
62
+ common_val = 2
63
+ another_common = 5
64
+ ( row_value = 4
65
+ value_foo = 5 ) ).`,
60
66
  };
61
67
  }
62
68
  getConfig() {
@@ -169,6 +175,27 @@ foo = VALUE #(
169
175
  candidates.push({ parameters });
170
176
  }
171
177
  }
178
+ for (const vb of stru.findAllExpressionsRecursive(Expressions.ValueBodyLine)) {
179
+ const parameters = [];
180
+ const fieldAssignments = vb.findDirectExpressions(Expressions.FieldAssignment);
181
+ if (fieldAssignments.length <= 1) {
182
+ continue;
183
+ }
184
+ for (const fs of fieldAssignments) {
185
+ const children = fs.getChildren();
186
+ if (children.length < 3) {
187
+ continue; // unexpected
188
+ }
189
+ parameters.push({
190
+ left: children[0],
191
+ eq: children[1].getFirstToken().getStart(),
192
+ right: children[2],
193
+ });
194
+ }
195
+ if (parameters.length > 0) {
196
+ candidates.push({ parameters });
197
+ }
198
+ }
172
199
  return candidates;
173
200
  }
174
201
  raiseAndCreateCandidates(stru) {
@@ -1500,54 +1500,65 @@ ${indentation} output = ${topTarget}.`;
1500
1500
  let end = "";
1501
1501
  let structureName = uniqueName;
1502
1502
  let added = false;
1503
- let skip = false;
1504
1503
  let data = "";
1505
1504
  let previous = undefined;
1506
- for (const b of (valueBody === null || valueBody === void 0 ? void 0 : valueBody.getChildren()) || []) {
1507
- if (b.concatTokens() === "(" && added === false) {
1508
- structureName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
1509
- data = indentation + `DATA ${structureName} LIKE LINE OF ${uniqueName}.\n`;
1510
- }
1511
- if (b.get() instanceof Expressions.FieldAssignment) {
1505
+ for (const a of (valueBody === null || valueBody === void 0 ? void 0 : valueBody.getChildren()) || []) {
1506
+ if (a.get() instanceof Expressions.FieldAssignment) {
1512
1507
  if (added === false) {
1513
1508
  body += data;
1514
1509
  added = true;
1515
1510
  }
1516
- body += indentation + structureName + "-" + b.concatTokens() + ".\n";
1511
+ body += indentation + structureName + "-" + a.concatTokens() + ".\n";
1517
1512
  }
1518
- else if (b instanceof nodes_1.ExpressionNode && b.get() instanceof Expressions.For) {
1519
- const outlineFor = this.outlineFor(b, indentation, lowFile, highSyntax);
1513
+ else if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.For) {
1514
+ const outlineFor = this.outlineFor(a, indentation, lowFile, highSyntax);
1520
1515
  body += outlineFor.body;
1521
1516
  end = outlineFor.end + `.\n` + end;
1522
1517
  indentation += " ";
1523
1518
  }
1524
- else if (b.get() instanceof Expressions.Source) {
1519
+ else if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.Source) {
1520
+ // special handling for superflous value expression
1525
1521
  if ((valueBody === null || valueBody === void 0 ? void 0 : valueBody.getChildren().length) === 1) {
1526
- body += indentation + uniqueName + " = " + b.concatTokens() + `.\n`;
1527
- }
1528
- structureName = b.concatTokens();
1529
- if (base && (valueBody === null || valueBody === void 0 ? void 0 : valueBody.findDirectTokenByText("(")) === undefined) {
1530
- structureName = uniqueName;
1522
+ body += indentation + uniqueName + " = " + a.concatTokens() + `.\n`;
1531
1523
  }
1532
1524
  }
1533
- else if (b.get() instanceof Expressions.ValueBodyLines) {
1534
- body += indentation + "APPEND " + b.concatTokens() + ` TO ${uniqueName}.\n`;
1535
- skip = true;
1536
- }
1537
- else if (b instanceof nodes_1.ExpressionNode && b.get() instanceof Expressions.Let) {
1538
- body += this.outlineLet(b, indentation, highSyntax, lowFile);
1525
+ else if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.Let) {
1526
+ body += this.outlineLet(a, indentation, highSyntax, lowFile);
1539
1527
  }
1540
- else if (b.concatTokens() === ")") {
1541
- if (added === false && (previous === null || previous === void 0 ? void 0 : previous.concatTokens()) === "(") {
1542
- body += data;
1543
- added = true;
1544
- }
1545
- if (skip === false) {
1546
- body += indentation + `APPEND ${structureName} TO ${uniqueName}.\n`;
1528
+ if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.ValueBodyLine) {
1529
+ let skip = false;
1530
+ for (const b of (a === null || a === void 0 ? void 0 : a.getChildren()) || []) {
1531
+ if (b.concatTokens() === "(" && added === false) {
1532
+ structureName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);
1533
+ data = indentation + `DATA ${structureName} LIKE LINE OF ${uniqueName}.\n`;
1534
+ }
1535
+ if (b.get() instanceof Expressions.FieldAssignment) {
1536
+ if (added === false) {
1537
+ body += data;
1538
+ added = true;
1539
+ }
1540
+ body += indentation + structureName + "-" + b.concatTokens() + ".\n";
1541
+ }
1542
+ else if (b.get() instanceof Expressions.Source) {
1543
+ body += indentation + "APPEND " + b.concatTokens() + ` TO ${uniqueName}.\n`;
1544
+ skip = true;
1545
+ }
1546
+ else if (b.get() instanceof Expressions.ValueBodyLines) {
1547
+ body += indentation + "APPEND " + b.concatTokens() + ` TO ${uniqueName}.\n`;
1548
+ skip = true;
1549
+ }
1550
+ else if (b.concatTokens() === ")") {
1551
+ if (added === false && (previous === null || previous === void 0 ? void 0 : previous.concatTokens()) === "(") {
1552
+ body += data;
1553
+ added = true;
1554
+ }
1555
+ if (skip === false) {
1556
+ body += indentation + `APPEND ${structureName} TO ${uniqueName}.\n`;
1557
+ }
1558
+ }
1559
+ previous = b;
1547
1560
  }
1548
- skip = false;
1549
1561
  }
1550
- previous = b;
1551
1562
  }
1552
1563
  if (body === "" && ((_b = valueBody === null || valueBody === void 0 ? void 0 : valueBody.getLastChild()) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr().toUpperCase()) === "OPTIONAL") {
1553
1564
  const fieldChain = valueBody.findFirstExpression(Expressions.FieldChain);
@@ -50,7 +50,7 @@ This rule makes sure the spaces are consistently required across the language.`,
50
50
  }
51
51
  missingSpace(statement) {
52
52
  const found = statement.findAllExpressionsMulti([Expressions.CondSub, Expressions.SQLCond,
53
- Expressions.ValueBody, Expressions.NewObject, Expressions.Cond,
53
+ Expressions.ValueBodyLine, Expressions.NewObject, Expressions.Cond,
54
54
  Expressions.ComponentCond, Expressions.ComponentCondSub, Expressions.MethodCallParam], true);
55
55
  let pos = undefined;
56
56
  for (const f of found) {
@@ -70,8 +70,8 @@ This rule makes sure the spaces are consistently required across the language.`,
70
70
  else if (type instanceof Expressions.SQLCond) {
71
71
  pos = this.checkSQLCond(f);
72
72
  }
73
- else if (type instanceof Expressions.ValueBody) {
74
- pos = this.checkValueBody(f);
73
+ else if (type instanceof Expressions.ValueBodyLine) {
74
+ pos = this.checkValueBodyLine(f);
75
75
  }
76
76
  else if (type instanceof Expressions.NewObject) {
77
77
  pos = this.checkNewObject(f);
@@ -173,7 +173,7 @@ This rule makes sure the spaces are consistently required across the language.`,
173
173
  }
174
174
  return undefined;
175
175
  }
176
- checkValueBody(vb) {
176
+ checkValueBodyLine(vb) {
177
177
  var _a, _b;
178
178
  const children = vb.getChildren();
179
179
  for (let i = 0; i < children.length; i++) {
@@ -10,7 +10,7 @@ class SkipLogic {
10
10
  }
11
11
  skip(obj) {
12
12
  const global = this.reg.getConfig().getGlobal();
13
- if (global.skipGeneratedGatewayClasses
13
+ if (global.skipGeneratedGatewayClasses === true
14
14
  && obj instanceof objects_1.Class
15
15
  && this.isGeneratedGatewayClass(obj)) {
16
16
  return true;
@@ -24,23 +24,29 @@ class SkipLogic {
24
24
  return true;
25
25
  }
26
26
  }
27
- else if (global.skipGeneratedPersistentClasses
27
+ else if (global.skipGeneratedPersistentClasses === true
28
28
  && obj instanceof objects_1.Class
29
29
  && this.isGeneratedPersistentClass(obj)) {
30
30
  return true;
31
31
  }
32
- else if (global.skipGeneratedFunctionGroups
32
+ else if (global.skipGeneratedFunctionGroups === true
33
33
  && obj instanceof objects_1.FunctionGroup
34
34
  && this.isGeneratedFunctionGroup(obj)) {
35
35
  return true;
36
36
  }
37
- else if (obj instanceof objects_1.Class && this.isGeneratedProxyClass(obj)) {
37
+ else if (global.skipGeneratedProxyClasses === true
38
+ && obj instanceof objects_1.Class
39
+ && this.isGeneratedProxyClass(obj)) {
38
40
  return true;
39
41
  }
40
- else if (obj instanceof objects_1.Interface && this.isGeneratedProxyInterface(obj)) {
42
+ else if (global.skipGeneratedProxyInterfaces === true
43
+ && obj instanceof objects_1.Interface
44
+ && this.isGeneratedProxyInterface(obj)) {
41
45
  return true;
42
46
  }
43
- else if (obj instanceof objects_1.Interface && this.isGeneratedBOPFInterface(obj)) {
47
+ else if (global.skipGeneratedBOPFInterfaces === true
48
+ && obj instanceof objects_1.Interface
49
+ && this.isGeneratedBOPFInterface(obj)) {
44
50
  return true;
45
51
  }
46
52
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.91.39",
3
+ "version": "2.92.2",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -55,7 +55,7 @@
55
55
  "c8": "^7.12.0",
56
56
  "source-map-support": "^0.5.21",
57
57
  "ts-json-schema-generator": "^1.0.0",
58
- "typescript": "^4.7.4"
58
+ "typescript": "^4.8.2"
59
59
  },
60
60
  "dependencies": {
61
61
  "fast-xml-parser": "^4.0.9",