@abaplint/cli 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.
Files changed (2) hide show
  1. package/build/cli.js +138 -33
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -2893,6 +2893,9 @@ class ExpandMacros {
2893
2893
  this.globalMacros = globalMacros;
2894
2894
  this.reg = reg;
2895
2895
  }
2896
+ listMacroNames() {
2897
+ return this.macros.listMacroNames();
2898
+ }
2896
2899
  find(statements, file, clear = true) {
2897
2900
  var _a, _b, _c;
2898
2901
  let nameToken = undefined;
@@ -2946,7 +2949,7 @@ class ExpandMacros {
2946
2949
  for (const statement of statements) {
2947
2950
  const type = statement.get();
2948
2951
  if (type instanceof _statement_1.Unknown || type instanceof _statement_1.MacroCall) {
2949
- const macroName = this.findName(statement.getTokens());
2952
+ const macroName = ExpandMacros.findName(statement.getTokens());
2950
2953
  if (macroName && this.macros.isMacro(macroName)) {
2951
2954
  const filename = this.macros.getMacroFilename(macroName);
2952
2955
  if (filename) {
@@ -3038,7 +3041,7 @@ class ExpandMacros {
3038
3041
  }
3039
3042
  return result;
3040
3043
  }
3041
- findName(tokens) {
3044
+ static findName(tokens) {
3042
3045
  let macroName = undefined;
3043
3046
  let previous = undefined;
3044
3047
  for (const i of tokens) {
@@ -3094,40 +3097,40 @@ function commonDerivedTypes() {
3094
3097
  const entity = (0, combi_1.alt)(_1.TypeName, _1.EntityAssociation);
3095
3098
  // more-specific keyword phrases (e.g. "FAILED LATE") must precede less-specific ones ("FAILED")
3096
3099
  return [
3097
- (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("FAILED LATE", entity)),
3098
- (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("MAPPED LATE", entity)),
3099
- (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("REPORTED LATE", entity)),
3100
- (0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("FAILED EARLY", entity)),
3101
- (0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("MAPPED EARLY", entity)),
3102
- (0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("REPORTED EARLY", entity)),
3103
- (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FAILED", entity)),
3104
- (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("MAPPED", entity)),
3105
- (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("REPORTED", entity)),
3106
- (0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("FUNCTION IMPORT", entity)),
3107
- (0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("FUNCTION RESULT", entity)),
3108
- (0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("ACTION RESULT", entity)),
3109
- (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION KEY", entity)),
3110
- (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION REQUEST", entity)),
3111
- (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION RESULT", entity)),
3112
- (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES KEY", entity)),
3113
- (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES REQUEST", entity)),
3114
- (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES RESULT", entity)),
3115
- (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("AUTHORIZATION RESULT", entity)),
3116
- (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("AUTHORIZATION KEY", entity)),
3117
- (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES RESULT", entity)),
3118
- (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES KEY", entity)),
3119
- (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("PERMISSIONS KEY", entity)),
3100
+ (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("FAILED LATE", entity), { also: combi_1.AlsoIn.OpenABAP }),
3101
+ (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("MAPPED LATE", entity), { also: combi_1.AlsoIn.OpenABAP }),
3102
+ (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("REPORTED LATE", entity), { also: combi_1.AlsoIn.OpenABAP }),
3103
+ (0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("FAILED EARLY", entity), { also: combi_1.AlsoIn.OpenABAP }),
3104
+ (0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("MAPPED EARLY", entity), { also: combi_1.AlsoIn.OpenABAP }),
3105
+ (0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("REPORTED EARLY", entity), { also: combi_1.AlsoIn.OpenABAP }),
3106
+ (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FAILED", entity), { also: combi_1.AlsoIn.OpenABAP }),
3107
+ (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("MAPPED", entity), { also: combi_1.AlsoIn.OpenABAP }),
3108
+ (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("REPORTED", entity), { also: combi_1.AlsoIn.OpenABAP }),
3109
+ (0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("FUNCTION IMPORT", entity), { also: combi_1.AlsoIn.OpenABAP }),
3110
+ (0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("FUNCTION RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }),
3111
+ (0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("ACTION RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }),
3112
+ (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION KEY", entity), { also: combi_1.AlsoIn.OpenABAP }),
3113
+ (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }),
3114
+ (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }),
3115
+ (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES KEY", entity), { also: combi_1.AlsoIn.OpenABAP }),
3116
+ (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }),
3117
+ (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }),
3118
+ (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("AUTHORIZATION RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }),
3119
+ (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("AUTHORIZATION KEY", entity), { also: combi_1.AlsoIn.OpenABAP }),
3120
+ (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }),
3121
+ (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES KEY", entity), { also: combi_1.AlsoIn.OpenABAP }),
3122
+ (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("PERMISSIONS KEY", entity), { also: combi_1.AlsoIn.OpenABAP }),
3120
3123
  (0, combi_1.seq)("READ IMPORT", entity),
3121
3124
  (0, combi_1.seq)("READ RESULT", entity),
3122
- (0, combi_1.ver)(version_1.Release.v915, (0, combi_1.seq)("READ CHANGES", entity)),
3125
+ (0, combi_1.ver)(version_1.Release.v915, (0, combi_1.seq)("READ CHANGES", entity), { also: combi_1.AlsoIn.OpenABAP }),
3123
3126
  (0, combi_1.seq)("CREATE", entity),
3124
3127
  (0, combi_1.seq)("DELETE", entity),
3125
3128
  (0, combi_1.seq)("UPDATE", entity),
3126
- (0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("LOCK", entity)),
3127
- (0, combi_1.ver)(version_1.Release.v775, (0, combi_1.seq)("KEY OF", entity)),
3128
- (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("DETERMINATION", entity)),
3129
- (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("VALIDATION", entity)),
3130
- (0, combi_1.ver)(version_1.Release.v778, (0, combi_1.seq)("CHANGE", entity)),
3129
+ (0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("LOCK", entity), { also: combi_1.AlsoIn.OpenABAP }),
3130
+ (0, combi_1.ver)(version_1.Release.v775, (0, combi_1.seq)("KEY OF", entity), { also: combi_1.AlsoIn.OpenABAP }),
3131
+ (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("DETERMINATION", entity), { also: combi_1.AlsoIn.OpenABAP }),
3132
+ (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("VALIDATION", entity), { also: combi_1.AlsoIn.OpenABAP }),
3133
+ (0, combi_1.ver)(version_1.Release.v778, (0, combi_1.seq)("CHANGE", entity), { also: combi_1.AlsoIn.OpenABAP }),
3131
3134
  ];
3132
3135
  }
3133
3136
  function derivedTypesAlt(...extra) {
@@ -10819,7 +10822,7 @@ class TypeTable extends combi_1.Expression {
10819
10822
  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")));
10820
10823
  const occurs = (0, combi_1.seq)("OCCURS", (0, combi_1.altPrio)(_1.Integer, field_chain_1.FieldChain));
10821
10824
  const entity = (0, combi_1.alt)(_1.TypeName, _1.EntityAssociation);
10822
- 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)));
10825
+ 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 }));
10823
10826
  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 });
10824
10827
  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));
10825
10828
  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));
@@ -47722,6 +47725,105 @@ exports.ArtifactsABAP = ArtifactsABAP;
47722
47725
 
47723
47726
  /***/ },
47724
47727
 
47728
+ /***/ "../core/build/src/abap/cross_include_macros.js"
47729
+ /*!******************************************************!*\
47730
+ !*** ../core/build/src/abap/cross_include_macros.js ***!
47731
+ \******************************************************/
47732
+ (__unused_webpack_module, exports, __webpack_require__) {
47733
+
47734
+ "use strict";
47735
+
47736
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
47737
+ exports.CrossIncludeMacros = void 0;
47738
+ const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "../core/build/src/objects/_abap_object.js");
47739
+ const program_1 = __webpack_require__(/*! ../objects/program */ "../core/build/src/objects/program.js");
47740
+ const _statement_1 = __webpack_require__(/*! ./2_statements/statements/_statement */ "../core/build/src/abap/2_statements/statements/_statement.js");
47741
+ const expand_macros_1 = __webpack_require__(/*! ./2_statements/expand_macros */ "../core/build/src/abap/2_statements/expand_macros.js");
47742
+ const include_graph_1 = __webpack_require__(/*! ../utils/include_graph */ "../core/build/src/utils/include_graph.js");
47743
+ // Macros can be defined in one include and used in a sibling include, connected
47744
+ // via the main program. Objects are parsed in isolation, so the sibling include
47745
+ // initially ends up with Unknown statements. This second pass finds the main
47746
+ // program(s) for such includes, collects the macro definitions visible there,
47747
+ // and re-parses the include with the macro names as extra global macros.
47748
+ class CrossIncludeMacros {
47749
+ constructor(reg) {
47750
+ this.reg = reg;
47751
+ }
47752
+ run() {
47753
+ const candidates = this.findCandidates();
47754
+ if (candidates.length === 0) {
47755
+ return;
47756
+ }
47757
+ const graph = new include_graph_1.IncludeGraph(this.reg);
47758
+ const config = this.reg.getConfig();
47759
+ const globalMacros = config.getSyntaxSetttings().globalMacros || [];
47760
+ for (const prog of candidates) {
47761
+ const mains = this.findMains(graph, prog);
47762
+ if (mains.size === 0) {
47763
+ continue;
47764
+ }
47765
+ const expand = new expand_macros_1.ExpandMacros(globalMacros, config.getRelease(), this.reg, config.getLanguageVersion());
47766
+ for (const main of mains) {
47767
+ for (const file of main.getABAPFiles()) {
47768
+ // find() follows INCLUDE statements, so this collects macros from the full include chain
47769
+ expand.find([...file.getStatements()], file, false);
47770
+ }
47771
+ }
47772
+ const macroNames = expand.listMacroNames();
47773
+ if (this.matchesUnknown(prog, new Set(macroNames))) {
47774
+ prog.setDirty();
47775
+ prog.parse(config.getRelease(), macroNames, this.reg, config.getLanguageVersion());
47776
+ }
47777
+ }
47778
+ }
47779
+ //////////////////////////////
47780
+ findCandidates() {
47781
+ const ret = [];
47782
+ for (const obj of this.reg.getObjects()) {
47783
+ if (!(obj instanceof program_1.Program) || obj.isInclude() === false) {
47784
+ continue;
47785
+ }
47786
+ for (const file of obj.getABAPFiles()) {
47787
+ if (file.getStatements().some(s => s.get() instanceof _statement_1.Unknown)) {
47788
+ ret.push(obj);
47789
+ break;
47790
+ }
47791
+ }
47792
+ }
47793
+ return ret;
47794
+ }
47795
+ findMains(graph, prog) {
47796
+ var _a;
47797
+ const ret = new Set();
47798
+ const filename = (_a = prog.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getFilename();
47799
+ for (const mainFilename of graph.listMainForInclude(filename)) {
47800
+ const file = this.reg.getFileByName(mainFilename);
47801
+ const obj = file ? this.reg.findObjectForFile(file) : undefined;
47802
+ if (obj instanceof _abap_object_1.ABAPObject) {
47803
+ ret.add(obj);
47804
+ }
47805
+ }
47806
+ return ret;
47807
+ }
47808
+ matchesUnknown(prog, macroNames) {
47809
+ for (const file of prog.getABAPFiles()) {
47810
+ for (const s of file.getStatements()) {
47811
+ if (s.get() instanceof _statement_1.Unknown) {
47812
+ const name = expand_macros_1.ExpandMacros.findName(s.getTokens());
47813
+ if (name !== undefined && macroNames.has(name.toUpperCase())) {
47814
+ return true;
47815
+ }
47816
+ }
47817
+ }
47818
+ }
47819
+ return false;
47820
+ }
47821
+ }
47822
+ exports.CrossIncludeMacros = CrossIncludeMacros;
47823
+ //# sourceMappingURL=cross_include_macros.js.map
47824
+
47825
+ /***/ },
47826
+
47725
47827
  /***/ "../core/build/src/abap/nodes/_abstract_node.js"
47726
47828
  /*!******************************************************!*\
47727
47829
  !*** ../core/build/src/abap/nodes/_abstract_node.js ***!
@@ -68404,6 +68506,7 @@ const ddic_references_1 = __webpack_require__(/*! ./ddic_references */ "../core/
68404
68506
  const rules_runner_1 = __webpack_require__(/*! ./rules_runner */ "../core/build/src/rules_runner.js");
68405
68507
  const msag_references_1 = __webpack_require__(/*! ./msag_references */ "../core/build/src/msag_references.js");
68406
68508
  const macro_references_1 = __webpack_require__(/*! ./macro_references */ "../core/build/src/macro_references.js");
68509
+ const cross_include_macros_1 = __webpack_require__(/*! ./abap/cross_include_macros */ "../core/build/src/abap/cross_include_macros.js");
68407
68510
  // todo, this should really be an instance in case there are multiple Registry'ies
68408
68511
  class ParsingPerformance {
68409
68512
  static clear() {
@@ -68469,7 +68572,7 @@ class Registry {
68469
68572
  }
68470
68573
  static abaplintVersion() {
68471
68574
  // magic, see build script "version.js"
68472
- return "2.119.55";
68575
+ return "2.119.56";
68473
68576
  }
68474
68577
  getDDICReferences() {
68475
68578
  return this.ddicReferences;
@@ -68693,6 +68796,7 @@ class Registry {
68693
68796
  for (const o of this.getObjects()) {
68694
68797
  this.parsePrivate(o);
68695
68798
  }
68799
+ new cross_include_macros_1.CrossIncludeMacros(this).run();
68696
68800
  new find_global_definitions_1.FindGlobalDefinitions(this).run();
68697
68801
  return this;
68698
68802
  }
@@ -68710,6 +68814,7 @@ class Registry {
68710
68814
  if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {
68711
68815
  ParsingPerformance.output();
68712
68816
  }
68817
+ new cross_include_macros_1.CrossIncludeMacros(this).run();
68713
68818
  new find_global_definitions_1.FindGlobalDefinitions(this).run(input === null || input === void 0 ? void 0 : input.progress);
68714
68819
  return this;
68715
68820
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.119.55",
3
+ "version": "2.119.56",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "homepage": "https://abaplint.org",
41
41
  "devDependencies": {
42
- "@abaplint/core": "^2.119.55",
42
+ "@abaplint/core": "^2.119.56",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",