@abaplint/core 2.85.36 → 2.85.37

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.
@@ -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.37";
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) {
@@ -1149,12 +1166,10 @@ ${indentation} output = ${topTarget}.`;
1149
1166
  continue;
1150
1167
  }
1151
1168
  const found = spag.findVariable(name);
1152
- if (found === undefined) {
1169
+ if (found === undefined
1170
+ || found.getType() instanceof basic_1.VoidType) {
1153
1171
  continue;
1154
1172
  }
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);
1157
- }
1158
1173
  const type = found.getType().getQualifiedName() ? (_b = found.getType().getQualifiedName()) === null || _b === void 0 ? void 0 : _b.toLowerCase() : found.getType().toABAP();
1159
1174
  const code = `DATA ${name} TYPE ${type}.\n` +
1160
1175
  " ".repeat(node.getFirstToken().getStart().getCol() - 1);
@@ -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.37",
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"