@abaplint/core 2.85.36 → 2.85.39

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.
@@ -107,6 +107,9 @@ class StatementParser {
107
107
  if (statement.get() instanceof _statement_1.Unknown
108
108
  && statement.concatTokens().toUpperCase().startsWith("CALL METHOD ") === false) {
109
109
  for (const { first, second } of this.buildSplits(statement.getTokens())) {
110
+ if (second.length === 1) {
111
+ continue; // probably punctuation
112
+ }
110
113
  const s = this.categorizeStatement(new nodes_1.StatementNode(new _statement_1.Unknown()).setChildren(this.tokensToNodes(second)));
111
114
  if (!(s.get() instanceof _statement_1.Unknown)) {
112
115
  result.push(new nodes_1.StatementNode(new _statement_1.Unknown()).setChildren(this.tokensToNodes(first)));
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.85.36";
71
+ return "2.85.39";
72
72
  }
73
73
  getDDICReferences() {
74
74
  return this.references;
@@ -19,6 +19,8 @@ const _typed_identifier_1 = require("../abap/types/_typed_identifier");
19
19
  const basic_1 = require("../abap/types/basic");
20
20
  const config_1 = require("../config");
21
21
  const tokens_1 = require("../abap/1_lexer/tokens");
22
+ const include_graph_1 = require("../utils/include_graph");
23
+ const objects_1 = require("../objects");
22
24
  // todo: refactor each sub-rule to new classes?
23
25
  // todo: add configuration
24
26
  class DownportConf extends _basic_rule_config_1.BasicRuleConfig {
@@ -75,10 +77,12 @@ Only one transformation is applied to a statement at a time, so multiple steps m
75
77
  const version = this.lowReg.getConfig().getVersion();
76
78
  if (version === version_1.Version.v702 || version === version_1.Version.OpenABAP) {
77
79
  this.initHighReg();
80
+ this.graph = new include_graph_1.IncludeGraph(reg);
78
81
  }
79
82
  return this;
80
83
  }
81
84
  run(lowObj) {
85
+ var _a;
82
86
  const ret = [];
83
87
  this.counter = 1;
84
88
  const version = this.lowReg.getConfig().getVersion();
@@ -92,7 +96,20 @@ Only one transformation is applied to a statement at a time, so multiple steps m
92
96
  if (highObj === undefined || !(highObj instanceof _abap_object_1.ABAPObject)) {
93
97
  return ret;
94
98
  }
95
- const highSyntax = new syntax_1.SyntaxLogic(this.highReg, highObj).run();
99
+ let highSyntaxObj = highObj;
100
+ // for includes do the syntax check via a main program
101
+ if (lowObj instanceof objects_1.Program && lowObj.isInclude()) {
102
+ const mains = this.graph.listMainForInclude((_a = lowObj.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getFilename());
103
+ if (mains.length <= 0) {
104
+ return [];
105
+ }
106
+ const f = this.highReg.getFileByName(mains[0]);
107
+ if (f === undefined) {
108
+ return [];
109
+ }
110
+ highSyntaxObj = this.highReg.findObjectForFile(f);
111
+ }
112
+ const highSyntax = new syntax_1.SyntaxLogic(this.highReg, highSyntaxObj).run();
96
113
  for (const lowFile of lowObj.getABAPFiles()) {
97
114
  const highFile = highObj.getABAPFileByName(lowFile.getFilename());
98
115
  if (highFile === undefined) {
@@ -1108,15 +1125,15 @@ ${indentation} output = ${topTarget}.`;
1108
1125
  continue;
1109
1126
  }
1110
1127
  const name = nameToken.getStr();
1111
- const spag = highSyntax.spaghetti.lookupPosition(nameToken.getStart(), lowFile.getFilename());
1112
- if (spag === undefined) {
1113
- continue;
1114
- }
1115
1128
  let type = "";
1116
1129
  if (node.concatTokens().toUpperCase().startsWith("APPEND INITIAL LINE TO ")) {
1117
1130
  type = "LIKE LINE OF " + ((_b = node.findFirstExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens());
1118
1131
  }
1119
1132
  else {
1133
+ const spag = highSyntax.spaghetti.lookupPosition(nameToken.getStart(), lowFile.getFilename());
1134
+ if (spag === undefined) {
1135
+ continue;
1136
+ }
1120
1137
  const found = spag.findVariable(name);
1121
1138
  if (found === undefined) {
1122
1139
  continue;
@@ -1152,8 +1169,8 @@ ${indentation} output = ${topTarget}.`;
1152
1169
  if (found === undefined) {
1153
1170
  continue;
1154
1171
  }
1155
- else if (found.getType() instanceof basic_1.VoidType) {
1156
- return issue_1.Issue.atToken(lowFile, i.getFirstToken(), "Error outlining voided type", this.getMetadata().key, this.conf.severity);
1172
+ else if (found.getType() instanceof basic_1.VoidType && found.getType().getQualifiedName() === undefined) {
1173
+ continue;
1157
1174
  }
1158
1175
  const type = found.getType().getQualifiedName() ? (_b = found.getType().getQualifiedName()) === null || _b === void 0 ? void 0 : _b.toLowerCase() : found.getType().toABAP();
1159
1176
  const code = `DATA ${name} TYPE ${type}.\n` +
@@ -1333,7 +1350,7 @@ ${indentation} output = ${topTarget}.`;
1333
1350
  }
1334
1351
  condition += c.concatTokens() + " ";
1335
1352
  }
1336
- const tableName = (_b = expression === null || expression === void 0 ? void 0 : expression.findFirstExpression(Expressions.SourceField)) === null || _b === void 0 ? void 0 : _b.concatTokens();
1353
+ const tableName = (_b = expression.findFirstExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens().split("[")[0];
1337
1354
  const uniqueName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
1338
1355
  const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
1339
1356
  const sy = func === "LINE_EXISTS" ? "sy-subrc" : "sy-tabix";
@@ -75,6 +75,9 @@ class IncludeGraph {
75
75
  }
76
76
  listMainForInclude(filename) {
77
77
  const ret = [];
78
+ if (filename === undefined) {
79
+ return [];
80
+ }
78
81
  for (const f of this.graph.findTop(filename)) {
79
82
  if (f.include === false) {
80
83
  ret.push(f.filename);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.85.36",
3
+ "version": "2.85.39",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -58,7 +58,7 @@
58
58
  "typescript": "^4.6.2"
59
59
  },
60
60
  "dependencies": {
61
- "fast-xml-parser": "^4.0.3",
61
+ "fast-xml-parser": "^4.0.4",
62
62
  "json5": "^2.2.0",
63
63
  "vscode-languageserver-protocol": "^3.16.0",
64
64
  "vscode-languageserver-types": "^3.16.0"