@abaplint/core 2.113.137 → 2.113.138

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.
@@ -67,7 +67,7 @@ class Registry {
67
67
  }
68
68
  static abaplintVersion() {
69
69
  // magic, see build script "version.sh"
70
- return "2.113.137";
70
+ return "2.113.138";
71
71
  }
72
72
  getDDICReferences() {
73
73
  return this.ddicReferences;
@@ -11,6 +11,7 @@ const _abap_object_1 = require("../objects/_abap_object");
11
11
  const severity_1 = require("../severity");
12
12
  // todo, check for cycles/circular dependencies, method findTop
13
13
  // todo, add configurable error for multiple use includes
14
+ const FMXXINCLUDE = /^(\/\w+\/)?L.+XX$/;
14
15
  function getABAPObjects(reg) {
15
16
  const ret = [];
16
17
  for (const o of reg.getObjects()) {
@@ -22,40 +23,33 @@ function getABAPObjects(reg) {
22
23
  }
23
24
  class Graph {
24
25
  constructor() {
25
- this.vertices = [];
26
- this.edges = [];
26
+ this.verticesIncludenameIndex = {};
27
+ this.verticesFilenameIndex = {};
28
+ this.edges = {};
27
29
  }
28
30
  addVertex(vertex) {
29
- this.vertices.push(vertex);
31
+ this.verticesIncludenameIndex[vertex.includeName.toUpperCase()] = vertex;
32
+ this.verticesFilenameIndex[vertex.filename.toUpperCase()] = vertex;
30
33
  }
31
- findInclude(includeName) {
32
- for (const v of this.vertices) {
33
- if (v.includeName.toUpperCase() === includeName.toUpperCase()) {
34
- return v;
35
- }
36
- }
37
- return undefined;
34
+ findVertexViaIncludename(includeName) {
35
+ return this.verticesIncludenameIndex[includeName.toUpperCase()];
38
36
  }
39
- findVertex(filename) {
40
- for (const v of this.vertices) {
41
- if (v.filename.toUpperCase() === filename.toUpperCase()) {
42
- return v;
43
- }
44
- }
45
- return undefined;
37
+ findVertexByFilename(filename) {
38
+ return this.verticesFilenameIndex[filename.toUpperCase()];
46
39
  }
47
40
  addEdge(from, toFilename) {
48
- this.edges.push({ from: from.filename, to: toFilename });
41
+ if (this.edges[from.filename] === undefined) {
42
+ this.edges[from.filename] = [];
43
+ }
44
+ this.edges[from.filename].push(toFilename);
49
45
  }
50
46
  findTop(filename) {
51
47
  const ret = [];
52
- for (const e of this.edges) {
53
- if (e.from === filename) {
54
- ret.push(...this.findTop(e.to));
55
- }
48
+ for (const to of this.edges[filename] || []) {
49
+ ret.push(...this.findTop(to));
56
50
  }
57
51
  if (ret.length === 0) {
58
- const found = this.findVertex(filename);
52
+ const found = this.findVertexByFilename(filename);
59
53
  if (found !== undefined) {
60
54
  ret.push(found);
61
55
  }
@@ -99,19 +93,23 @@ class IncludeGraph {
99
93
  this.addVertices();
100
94
  for (const o of getABAPObjects(this.reg)) {
101
95
  for (const f of o.getABAPFiles()) {
96
+ if (f.getFilename().includes(".prog.screen_") || f.getFilename().includes(".fugr.screen_")) {
97
+ // skip dynpro files
98
+ continue;
99
+ }
102
100
  for (const s of f.getStatements()) {
103
101
  if (s.get() instanceof statements_1.Include) {
104
- const ifFound = s.concatTokens().toUpperCase().includes("IF FOUND");
105
102
  const iexp = s.findFirstExpression(expressions_1.IncludeName);
106
103
  if (iexp === undefined) {
107
104
  throw new Error("unexpected Include node");
108
105
  }
109
106
  const name = iexp.getFirstToken().getStr().toUpperCase();
110
- if (name.match(/^(\/\w+\/)?L.+XX$/)) { // function module XX includes, possibily namespaced
107
+ if (name.match(FMXXINCLUDE)) { // function module XX includes, possibily namespaced
111
108
  continue;
112
109
  }
113
- const found = this.graph.findInclude(name);
110
+ const found = this.graph.findVertexViaIncludename(name);
114
111
  if (found === undefined) {
112
+ const ifFound = s.concatTokens().toUpperCase().includes("IF FOUND");
115
113
  if (ifFound === false) {
116
114
  const issue = issue_1.Issue.atStatement(f, s, "Include " + name + " not found", new check_include_1.CheckInclude().getMetadata().key, severity_1.Severity.Error);
117
115
  this.issues.push(issue);
@@ -131,7 +129,7 @@ class IncludeGraph {
131
129
  this.findUnusedIncludes();
132
130
  }
133
131
  findUnusedIncludes() {
134
- for (const v of this.graph.vertices) {
132
+ for (const v of Object.values(this.graph.verticesFilenameIndex)) {
135
133
  if (v.include === true) {
136
134
  if (this.listMainForInclude(v.filename).length === 0) {
137
135
  const f = this.reg.getFileByName(v.filename);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.113.137",
3
+ "version": "2.113.138",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",