@abaplint/core 2.119.55 → 2.119.56
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.
- package/build/src/abap/2_statements/expand_macros.js +5 -2
- package/build/src/abap/2_statements/expressions/_derived_types.js +29 -29
- package/build/src/abap/2_statements/expressions/type_table.js +1 -1
- package/build/src/abap/cross_include_macros.js +89 -0
- package/build/src/registry.js +4 -1
- package/package.json +1 -1
|
@@ -89,6 +89,9 @@ class ExpandMacros {
|
|
|
89
89
|
this.globalMacros = globalMacros;
|
|
90
90
|
this.reg = reg;
|
|
91
91
|
}
|
|
92
|
+
listMacroNames() {
|
|
93
|
+
return this.macros.listMacroNames();
|
|
94
|
+
}
|
|
92
95
|
find(statements, file, clear = true) {
|
|
93
96
|
var _a, _b, _c;
|
|
94
97
|
let nameToken = undefined;
|
|
@@ -142,7 +145,7 @@ class ExpandMacros {
|
|
|
142
145
|
for (const statement of statements) {
|
|
143
146
|
const type = statement.get();
|
|
144
147
|
if (type instanceof _statement_1.Unknown || type instanceof _statement_1.MacroCall) {
|
|
145
|
-
const macroName =
|
|
148
|
+
const macroName = ExpandMacros.findName(statement.getTokens());
|
|
146
149
|
if (macroName && this.macros.isMacro(macroName)) {
|
|
147
150
|
const filename = this.macros.getMacroFilename(macroName);
|
|
148
151
|
if (filename) {
|
|
@@ -234,7 +237,7 @@ class ExpandMacros {
|
|
|
234
237
|
}
|
|
235
238
|
return result;
|
|
236
239
|
}
|
|
237
|
-
findName(tokens) {
|
|
240
|
+
static findName(tokens) {
|
|
238
241
|
let macroName = undefined;
|
|
239
242
|
let previous = undefined;
|
|
240
243
|
for (const i of tokens) {
|
|
@@ -9,40 +9,40 @@ function commonDerivedTypes() {
|
|
|
9
9
|
const entity = (0, combi_1.alt)(_1.TypeName, _1.EntityAssociation);
|
|
10
10
|
// more-specific keyword phrases (e.g. "FAILED LATE") must precede less-specific ones ("FAILED")
|
|
11
11
|
return [
|
|
12
|
-
(0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("FAILED LATE", entity)),
|
|
13
|
-
(0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("MAPPED LATE", entity)),
|
|
14
|
-
(0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("REPORTED LATE", entity)),
|
|
15
|
-
(0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("FAILED EARLY", entity)),
|
|
16
|
-
(0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("MAPPED EARLY", entity)),
|
|
17
|
-
(0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("REPORTED EARLY", entity)),
|
|
18
|
-
(0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FAILED", entity)),
|
|
19
|
-
(0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("MAPPED", entity)),
|
|
20
|
-
(0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("REPORTED", entity)),
|
|
21
|
-
(0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("FUNCTION IMPORT", entity)),
|
|
22
|
-
(0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("FUNCTION RESULT", entity)),
|
|
23
|
-
(0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("ACTION RESULT", entity)),
|
|
24
|
-
(0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION KEY", entity)),
|
|
25
|
-
(0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION REQUEST", entity)),
|
|
26
|
-
(0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION RESULT", entity)),
|
|
27
|
-
(0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES KEY", entity)),
|
|
28
|
-
(0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES REQUEST", entity)),
|
|
29
|
-
(0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES RESULT", entity)),
|
|
30
|
-
(0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("AUTHORIZATION RESULT", entity)),
|
|
31
|
-
(0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("AUTHORIZATION KEY", entity)),
|
|
32
|
-
(0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES RESULT", entity)),
|
|
33
|
-
(0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES KEY", entity)),
|
|
34
|
-
(0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("PERMISSIONS KEY", entity)),
|
|
12
|
+
(0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("FAILED LATE", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
13
|
+
(0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("MAPPED LATE", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
14
|
+
(0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("REPORTED LATE", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
15
|
+
(0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("FAILED EARLY", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
16
|
+
(0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("MAPPED EARLY", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
17
|
+
(0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("REPORTED EARLY", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
18
|
+
(0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FAILED", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
19
|
+
(0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("MAPPED", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
20
|
+
(0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("REPORTED", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
21
|
+
(0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("FUNCTION IMPORT", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
22
|
+
(0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("FUNCTION RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
23
|
+
(0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("ACTION RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
24
|
+
(0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION KEY", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
25
|
+
(0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
26
|
+
(0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
27
|
+
(0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES KEY", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
28
|
+
(0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
29
|
+
(0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
30
|
+
(0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("AUTHORIZATION RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
31
|
+
(0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("AUTHORIZATION KEY", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
32
|
+
(0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
33
|
+
(0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES KEY", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
34
|
+
(0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("PERMISSIONS KEY", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
35
35
|
(0, combi_1.seq)("READ IMPORT", entity),
|
|
36
36
|
(0, combi_1.seq)("READ RESULT", entity),
|
|
37
|
-
(0, combi_1.ver)(version_1.Release.v915, (0, combi_1.seq)("READ CHANGES", entity)),
|
|
37
|
+
(0, combi_1.ver)(version_1.Release.v915, (0, combi_1.seq)("READ CHANGES", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
38
38
|
(0, combi_1.seq)("CREATE", entity),
|
|
39
39
|
(0, combi_1.seq)("DELETE", entity),
|
|
40
40
|
(0, combi_1.seq)("UPDATE", entity),
|
|
41
|
-
(0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("LOCK", entity)),
|
|
42
|
-
(0, combi_1.ver)(version_1.Release.v775, (0, combi_1.seq)("KEY OF", entity)),
|
|
43
|
-
(0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("DETERMINATION", entity)),
|
|
44
|
-
(0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("VALIDATION", entity)),
|
|
45
|
-
(0, combi_1.ver)(version_1.Release.v778, (0, combi_1.seq)("CHANGE", entity)),
|
|
41
|
+
(0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("LOCK", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
42
|
+
(0, combi_1.ver)(version_1.Release.v775, (0, combi_1.seq)("KEY OF", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
43
|
+
(0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("DETERMINATION", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
44
|
+
(0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("VALIDATION", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
45
|
+
(0, combi_1.ver)(version_1.Release.v778, (0, combi_1.seq)("CHANGE", entity), { also: combi_1.AlsoIn.OpenABAP }),
|
|
46
46
|
];
|
|
47
47
|
}
|
|
48
48
|
function derivedTypesAlt(...extra) {
|
|
@@ -21,7 +21,7 @@ class TypeTable extends combi_1.Expression {
|
|
|
21
21
|
const typetable = (0, combi_1.alt)(generic, (0, combi_1.seq)(normal1, (0, combi_1.alt)((0, combi_1.opt)((0, combi_1.per)(header, initial, (0, combi_1.plusPrio)(type_table_key_1.TypeTableKey))), (0, combi_1.seq)((0, combi_1.plus)(type_table_key_1.TypeTableKey), (0, combi_1.optPrio)(initial))), (0, combi_1.optPrio)("VALUE IS INITIAL")));
|
|
22
22
|
const occurs = (0, combi_1.seq)("OCCURS", (0, combi_1.altPrio)(_1.Integer, field_chain_1.FieldChain));
|
|
23
23
|
const entity = (0, combi_1.alt)(_1.TypeName, _1.EntityAssociation);
|
|
24
|
-
const derivedTypes = (0, _derived_types_1.derivedTypesAlt)((0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("ACTION IMPORT", entity)), (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("READ LINK", entity)), (0, combi_1.ver)(version_1.Release.v787, (0, combi_1.seq)("EVENT", entity)));
|
|
24
|
+
const derivedTypes = (0, _derived_types_1.derivedTypesAlt)((0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("ACTION IMPORT", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("READ LINK", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v787, (0, combi_1.seq)("EVENT", entity), { also: combi_1.AlsoIn.OpenABAP }));
|
|
25
25
|
const derived = (0, combi_1.ver)(version_1.Release.v770, (0, combi_1.seq)("TABLE FOR", derivedTypes, (0, combi_1.optPrio)("VALUE IS INITIAL")), { also: combi_1.AlsoIn.OpenABAP });
|
|
26
26
|
const oldType = (0, combi_1.seq)((0, combi_1.opt)("REF TO"), _1.TypeName, (0, combi_1.alt)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), header));
|
|
27
27
|
const oldLike = (0, combi_1.seq)((0, combi_1.opt)("REF TO"), field_chain_1.FieldChain, (0, combi_1.alt)((0, combi_1.seq)(occurs, (0, combi_1.opt)(header)), header));
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CrossIncludeMacros = void 0;
|
|
4
|
+
const _abap_object_1 = require("../objects/_abap_object");
|
|
5
|
+
const program_1 = require("../objects/program");
|
|
6
|
+
const _statement_1 = require("./2_statements/statements/_statement");
|
|
7
|
+
const expand_macros_1 = require("./2_statements/expand_macros");
|
|
8
|
+
const include_graph_1 = require("../utils/include_graph");
|
|
9
|
+
// Macros can be defined in one include and used in a sibling include, connected
|
|
10
|
+
// via the main program. Objects are parsed in isolation, so the sibling include
|
|
11
|
+
// initially ends up with Unknown statements. This second pass finds the main
|
|
12
|
+
// program(s) for such includes, collects the macro definitions visible there,
|
|
13
|
+
// and re-parses the include with the macro names as extra global macros.
|
|
14
|
+
class CrossIncludeMacros {
|
|
15
|
+
constructor(reg) {
|
|
16
|
+
this.reg = reg;
|
|
17
|
+
}
|
|
18
|
+
run() {
|
|
19
|
+
const candidates = this.findCandidates();
|
|
20
|
+
if (candidates.length === 0) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const graph = new include_graph_1.IncludeGraph(this.reg);
|
|
24
|
+
const config = this.reg.getConfig();
|
|
25
|
+
const globalMacros = config.getSyntaxSetttings().globalMacros || [];
|
|
26
|
+
for (const prog of candidates) {
|
|
27
|
+
const mains = this.findMains(graph, prog);
|
|
28
|
+
if (mains.size === 0) {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const expand = new expand_macros_1.ExpandMacros(globalMacros, config.getRelease(), this.reg, config.getLanguageVersion());
|
|
32
|
+
for (const main of mains) {
|
|
33
|
+
for (const file of main.getABAPFiles()) {
|
|
34
|
+
// find() follows INCLUDE statements, so this collects macros from the full include chain
|
|
35
|
+
expand.find([...file.getStatements()], file, false);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const macroNames = expand.listMacroNames();
|
|
39
|
+
if (this.matchesUnknown(prog, new Set(macroNames))) {
|
|
40
|
+
prog.setDirty();
|
|
41
|
+
prog.parse(config.getRelease(), macroNames, this.reg, config.getLanguageVersion());
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//////////////////////////////
|
|
46
|
+
findCandidates() {
|
|
47
|
+
const ret = [];
|
|
48
|
+
for (const obj of this.reg.getObjects()) {
|
|
49
|
+
if (!(obj instanceof program_1.Program) || obj.isInclude() === false) {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
for (const file of obj.getABAPFiles()) {
|
|
53
|
+
if (file.getStatements().some(s => s.get() instanceof _statement_1.Unknown)) {
|
|
54
|
+
ret.push(obj);
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return ret;
|
|
60
|
+
}
|
|
61
|
+
findMains(graph, prog) {
|
|
62
|
+
var _a;
|
|
63
|
+
const ret = new Set();
|
|
64
|
+
const filename = (_a = prog.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getFilename();
|
|
65
|
+
for (const mainFilename of graph.listMainForInclude(filename)) {
|
|
66
|
+
const file = this.reg.getFileByName(mainFilename);
|
|
67
|
+
const obj = file ? this.reg.findObjectForFile(file) : undefined;
|
|
68
|
+
if (obj instanceof _abap_object_1.ABAPObject) {
|
|
69
|
+
ret.add(obj);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return ret;
|
|
73
|
+
}
|
|
74
|
+
matchesUnknown(prog, macroNames) {
|
|
75
|
+
for (const file of prog.getABAPFiles()) {
|
|
76
|
+
for (const s of file.getStatements()) {
|
|
77
|
+
if (s.get() instanceof _statement_1.Unknown) {
|
|
78
|
+
const name = expand_macros_1.ExpandMacros.findName(s.getTokens());
|
|
79
|
+
if (name !== undefined && macroNames.has(name.toUpperCase())) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.CrossIncludeMacros = CrossIncludeMacros;
|
|
89
|
+
//# sourceMappingURL=cross_include_macros.js.map
|
package/build/src/registry.js
CHANGED
|
@@ -9,6 +9,7 @@ const ddic_references_1 = require("./ddic_references");
|
|
|
9
9
|
const rules_runner_1 = require("./rules_runner");
|
|
10
10
|
const msag_references_1 = require("./msag_references");
|
|
11
11
|
const macro_references_1 = require("./macro_references");
|
|
12
|
+
const cross_include_macros_1 = require("./abap/cross_include_macros");
|
|
12
13
|
// todo, this should really be an instance in case there are multiple Registry'ies
|
|
13
14
|
class ParsingPerformance {
|
|
14
15
|
static clear() {
|
|
@@ -74,7 +75,7 @@ class Registry {
|
|
|
74
75
|
}
|
|
75
76
|
static abaplintVersion() {
|
|
76
77
|
// magic, see build script "version.js"
|
|
77
|
-
return "2.119.
|
|
78
|
+
return "2.119.56";
|
|
78
79
|
}
|
|
79
80
|
getDDICReferences() {
|
|
80
81
|
return this.ddicReferences;
|
|
@@ -298,6 +299,7 @@ class Registry {
|
|
|
298
299
|
for (const o of this.getObjects()) {
|
|
299
300
|
this.parsePrivate(o);
|
|
300
301
|
}
|
|
302
|
+
new cross_include_macros_1.CrossIncludeMacros(this).run();
|
|
301
303
|
new find_global_definitions_1.FindGlobalDefinitions(this).run();
|
|
302
304
|
return this;
|
|
303
305
|
}
|
|
@@ -315,6 +317,7 @@ class Registry {
|
|
|
315
317
|
if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {
|
|
316
318
|
ParsingPerformance.output();
|
|
317
319
|
}
|
|
320
|
+
new cross_include_macros_1.CrossIncludeMacros(this).run();
|
|
318
321
|
new find_global_definitions_1.FindGlobalDefinitions(this).run(input === null || input === void 0 ? void 0 : input.progress);
|
|
319
322
|
return this;
|
|
320
323
|
}
|