@abaplint/transpiler-cli 2.13.34 → 2.13.36

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/bundle.js +138 -33
  2. package/package.json +3 -3
package/build/bundle.js CHANGED
@@ -3316,6 +3316,9 @@ class ExpandMacros {
3316
3316
  this.globalMacros = globalMacros;
3317
3317
  this.reg = reg;
3318
3318
  }
3319
+ listMacroNames() {
3320
+ return this.macros.listMacroNames();
3321
+ }
3319
3322
  find(statements, file, clear = true) {
3320
3323
  var _a, _b, _c;
3321
3324
  let nameToken = undefined;
@@ -3369,7 +3372,7 @@ class ExpandMacros {
3369
3372
  for (const statement of statements) {
3370
3373
  const type = statement.get();
3371
3374
  if (type instanceof _statement_1.Unknown || type instanceof _statement_1.MacroCall) {
3372
- const macroName = this.findName(statement.getTokens());
3375
+ const macroName = ExpandMacros.findName(statement.getTokens());
3373
3376
  if (macroName && this.macros.isMacro(macroName)) {
3374
3377
  const filename = this.macros.getMacroFilename(macroName);
3375
3378
  if (filename) {
@@ -3461,7 +3464,7 @@ class ExpandMacros {
3461
3464
  }
3462
3465
  return result;
3463
3466
  }
3464
- findName(tokens) {
3467
+ static findName(tokens) {
3465
3468
  let macroName = undefined;
3466
3469
  let previous = undefined;
3467
3470
  for (const i of tokens) {
@@ -3517,40 +3520,40 @@ function commonDerivedTypes() {
3517
3520
  const entity = (0, combi_1.alt)(_1.TypeName, _1.EntityAssociation);
3518
3521
  // more-specific keyword phrases (e.g. "FAILED LATE") must precede less-specific ones ("FAILED")
3519
3522
  return [
3520
- (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("FAILED LATE", entity)),
3521
- (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("MAPPED LATE", entity)),
3522
- (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("REPORTED LATE", entity)),
3523
- (0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("FAILED EARLY", entity)),
3524
- (0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("MAPPED EARLY", entity)),
3525
- (0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("REPORTED EARLY", entity)),
3526
- (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FAILED", entity)),
3527
- (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("MAPPED", entity)),
3528
- (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("REPORTED", entity)),
3529
- (0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("FUNCTION IMPORT", entity)),
3530
- (0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("FUNCTION RESULT", entity)),
3531
- (0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("ACTION RESULT", entity)),
3532
- (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION KEY", entity)),
3533
- (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION REQUEST", entity)),
3534
- (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION RESULT", entity)),
3535
- (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES KEY", entity)),
3536
- (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES REQUEST", entity)),
3537
- (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES RESULT", entity)),
3538
- (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("AUTHORIZATION RESULT", entity)),
3539
- (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("AUTHORIZATION KEY", entity)),
3540
- (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES RESULT", entity)),
3541
- (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES KEY", entity)),
3542
- (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("PERMISSIONS KEY", entity)),
3523
+ (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("FAILED LATE", entity), { also: combi_1.AlsoIn.OpenABAP }),
3524
+ (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("MAPPED LATE", entity), { also: combi_1.AlsoIn.OpenABAP }),
3525
+ (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("REPORTED LATE", entity), { also: combi_1.AlsoIn.OpenABAP }),
3526
+ (0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("FAILED EARLY", entity), { also: combi_1.AlsoIn.OpenABAP }),
3527
+ (0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("MAPPED EARLY", entity), { also: combi_1.AlsoIn.OpenABAP }),
3528
+ (0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("REPORTED EARLY", entity), { also: combi_1.AlsoIn.OpenABAP }),
3529
+ (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FAILED", entity), { also: combi_1.AlsoIn.OpenABAP }),
3530
+ (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("MAPPED", entity), { also: combi_1.AlsoIn.OpenABAP }),
3531
+ (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("REPORTED", entity), { also: combi_1.AlsoIn.OpenABAP }),
3532
+ (0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("FUNCTION IMPORT", entity), { also: combi_1.AlsoIn.OpenABAP }),
3533
+ (0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("FUNCTION RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }),
3534
+ (0, combi_1.ver)(version_1.Release.v773, (0, combi_1.seq)("ACTION RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }),
3535
+ (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION KEY", entity), { also: combi_1.AlsoIn.OpenABAP }),
3536
+ (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }),
3537
+ (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE AUTHORIZATION RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }),
3538
+ (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES KEY", entity), { also: combi_1.AlsoIn.OpenABAP }),
3539
+ (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }),
3540
+ (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("INSTANCE FEATURES RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }),
3541
+ (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("AUTHORIZATION RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }),
3542
+ (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("AUTHORIZATION KEY", entity), { also: combi_1.AlsoIn.OpenABAP }),
3543
+ (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }),
3544
+ (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES KEY", entity), { also: combi_1.AlsoIn.OpenABAP }),
3545
+ (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("PERMISSIONS KEY", entity), { also: combi_1.AlsoIn.OpenABAP }),
3543
3546
  (0, combi_1.seq)("READ IMPORT", entity),
3544
3547
  (0, combi_1.seq)("READ RESULT", entity),
3545
- (0, combi_1.ver)(version_1.Release.v915, (0, combi_1.seq)("READ CHANGES", entity)),
3548
+ (0, combi_1.ver)(version_1.Release.v915, (0, combi_1.seq)("READ CHANGES", entity), { also: combi_1.AlsoIn.OpenABAP }),
3546
3549
  (0, combi_1.seq)("CREATE", entity),
3547
3550
  (0, combi_1.seq)("DELETE", entity),
3548
3551
  (0, combi_1.seq)("UPDATE", entity),
3549
- (0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("LOCK", entity)),
3550
- (0, combi_1.ver)(version_1.Release.v775, (0, combi_1.seq)("KEY OF", entity)),
3551
- (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("DETERMINATION", entity)),
3552
- (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("VALIDATION", entity)),
3553
- (0, combi_1.ver)(version_1.Release.v778, (0, combi_1.seq)("CHANGE", entity)),
3552
+ (0, combi_1.ver)(version_1.Release.v777, (0, combi_1.seq)("LOCK", entity), { also: combi_1.AlsoIn.OpenABAP }),
3553
+ (0, combi_1.ver)(version_1.Release.v775, (0, combi_1.seq)("KEY OF", entity), { also: combi_1.AlsoIn.OpenABAP }),
3554
+ (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("DETERMINATION", entity), { also: combi_1.AlsoIn.OpenABAP }),
3555
+ (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("VALIDATION", entity), { also: combi_1.AlsoIn.OpenABAP }),
3556
+ (0, combi_1.ver)(version_1.Release.v778, (0, combi_1.seq)("CHANGE", entity), { also: combi_1.AlsoIn.OpenABAP }),
3554
3557
  ];
3555
3558
  }
3556
3559
  function derivedTypesAlt(...extra) {
@@ -11242,7 +11245,7 @@ class TypeTable extends combi_1.Expression {
11242
11245
  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")));
11243
11246
  const occurs = (0, combi_1.seq)("OCCURS", (0, combi_1.altPrio)(_1.Integer, field_chain_1.FieldChain));
11244
11247
  const entity = (0, combi_1.alt)(_1.TypeName, _1.EntityAssociation);
11245
- 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)));
11248
+ 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 }));
11246
11249
  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 });
11247
11250
  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));
11248
11251
  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));
@@ -48145,6 +48148,105 @@ exports.ArtifactsABAP = ArtifactsABAP;
48145
48148
 
48146
48149
  /***/ },
48147
48150
 
48151
+ /***/ "./node_modules/@abaplint/core/build/src/abap/cross_include_macros.js"
48152
+ /*!****************************************************************************!*\
48153
+ !*** ./node_modules/@abaplint/core/build/src/abap/cross_include_macros.js ***!
48154
+ \****************************************************************************/
48155
+ (__unused_webpack_module, exports, __webpack_require__) {
48156
+
48157
+ "use strict";
48158
+
48159
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
48160
+ exports.CrossIncludeMacros = void 0;
48161
+ const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "./node_modules/@abaplint/core/build/src/objects/_abap_object.js");
48162
+ const program_1 = __webpack_require__(/*! ../objects/program */ "./node_modules/@abaplint/core/build/src/objects/program.js");
48163
+ const _statement_1 = __webpack_require__(/*! ./2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
48164
+ const expand_macros_1 = __webpack_require__(/*! ./2_statements/expand_macros */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expand_macros.js");
48165
+ const include_graph_1 = __webpack_require__(/*! ../utils/include_graph */ "./node_modules/@abaplint/core/build/src/utils/include_graph.js");
48166
+ // Macros can be defined in one include and used in a sibling include, connected
48167
+ // via the main program. Objects are parsed in isolation, so the sibling include
48168
+ // initially ends up with Unknown statements. This second pass finds the main
48169
+ // program(s) for such includes, collects the macro definitions visible there,
48170
+ // and re-parses the include with the macro names as extra global macros.
48171
+ class CrossIncludeMacros {
48172
+ constructor(reg) {
48173
+ this.reg = reg;
48174
+ }
48175
+ run() {
48176
+ const candidates = this.findCandidates();
48177
+ if (candidates.length === 0) {
48178
+ return;
48179
+ }
48180
+ const graph = new include_graph_1.IncludeGraph(this.reg);
48181
+ const config = this.reg.getConfig();
48182
+ const globalMacros = config.getSyntaxSetttings().globalMacros || [];
48183
+ for (const prog of candidates) {
48184
+ const mains = this.findMains(graph, prog);
48185
+ if (mains.size === 0) {
48186
+ continue;
48187
+ }
48188
+ const expand = new expand_macros_1.ExpandMacros(globalMacros, config.getRelease(), this.reg, config.getLanguageVersion());
48189
+ for (const main of mains) {
48190
+ for (const file of main.getABAPFiles()) {
48191
+ // find() follows INCLUDE statements, so this collects macros from the full include chain
48192
+ expand.find([...file.getStatements()], file, false);
48193
+ }
48194
+ }
48195
+ const macroNames = expand.listMacroNames();
48196
+ if (this.matchesUnknown(prog, new Set(macroNames))) {
48197
+ prog.setDirty();
48198
+ prog.parse(config.getRelease(), macroNames, this.reg, config.getLanguageVersion());
48199
+ }
48200
+ }
48201
+ }
48202
+ //////////////////////////////
48203
+ findCandidates() {
48204
+ const ret = [];
48205
+ for (const obj of this.reg.getObjects()) {
48206
+ if (!(obj instanceof program_1.Program) || obj.isInclude() === false) {
48207
+ continue;
48208
+ }
48209
+ for (const file of obj.getABAPFiles()) {
48210
+ if (file.getStatements().some(s => s.get() instanceof _statement_1.Unknown)) {
48211
+ ret.push(obj);
48212
+ break;
48213
+ }
48214
+ }
48215
+ }
48216
+ return ret;
48217
+ }
48218
+ findMains(graph, prog) {
48219
+ var _a;
48220
+ const ret = new Set();
48221
+ const filename = (_a = prog.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getFilename();
48222
+ for (const mainFilename of graph.listMainForInclude(filename)) {
48223
+ const file = this.reg.getFileByName(mainFilename);
48224
+ const obj = file ? this.reg.findObjectForFile(file) : undefined;
48225
+ if (obj instanceof _abap_object_1.ABAPObject) {
48226
+ ret.add(obj);
48227
+ }
48228
+ }
48229
+ return ret;
48230
+ }
48231
+ matchesUnknown(prog, macroNames) {
48232
+ for (const file of prog.getABAPFiles()) {
48233
+ for (const s of file.getStatements()) {
48234
+ if (s.get() instanceof _statement_1.Unknown) {
48235
+ const name = expand_macros_1.ExpandMacros.findName(s.getTokens());
48236
+ if (name !== undefined && macroNames.has(name.toUpperCase())) {
48237
+ return true;
48238
+ }
48239
+ }
48240
+ }
48241
+ }
48242
+ return false;
48243
+ }
48244
+ }
48245
+ exports.CrossIncludeMacros = CrossIncludeMacros;
48246
+ //# sourceMappingURL=cross_include_macros.js.map
48247
+
48248
+ /***/ },
48249
+
48148
48250
  /***/ "./node_modules/@abaplint/core/build/src/abap/nodes/_abstract_node.js"
48149
48251
  /*!****************************************************************************!*\
48150
48252
  !*** ./node_modules/@abaplint/core/build/src/abap/nodes/_abstract_node.js ***!
@@ -68827,6 +68929,7 @@ const ddic_references_1 = __webpack_require__(/*! ./ddic_references */ "./node_m
68827
68929
  const rules_runner_1 = __webpack_require__(/*! ./rules_runner */ "./node_modules/@abaplint/core/build/src/rules_runner.js");
68828
68930
  const msag_references_1 = __webpack_require__(/*! ./msag_references */ "./node_modules/@abaplint/core/build/src/msag_references.js");
68829
68931
  const macro_references_1 = __webpack_require__(/*! ./macro_references */ "./node_modules/@abaplint/core/build/src/macro_references.js");
68932
+ const cross_include_macros_1 = __webpack_require__(/*! ./abap/cross_include_macros */ "./node_modules/@abaplint/core/build/src/abap/cross_include_macros.js");
68830
68933
  // todo, this should really be an instance in case there are multiple Registry'ies
68831
68934
  class ParsingPerformance {
68832
68935
  static clear() {
@@ -68892,7 +68995,7 @@ class Registry {
68892
68995
  }
68893
68996
  static abaplintVersion() {
68894
68997
  // magic, see build script "version.js"
68895
- return "2.119.55";
68998
+ return "2.119.56";
68896
68999
  }
68897
69000
  getDDICReferences() {
68898
69001
  return this.ddicReferences;
@@ -69116,6 +69219,7 @@ class Registry {
69116
69219
  for (const o of this.getObjects()) {
69117
69220
  this.parsePrivate(o);
69118
69221
  }
69222
+ new cross_include_macros_1.CrossIncludeMacros(this).run();
69119
69223
  new find_global_definitions_1.FindGlobalDefinitions(this).run();
69120
69224
  return this;
69121
69225
  }
@@ -69133,6 +69237,7 @@ class Registry {
69133
69237
  if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {
69134
69238
  ParsingPerformance.output();
69135
69239
  }
69240
+ new cross_include_macros_1.CrossIncludeMacros(this).run();
69136
69241
  new find_global_definitions_1.FindGlobalDefinitions(this).run(input === null || input === void 0 ? void 0 : input.progress);
69137
69242
  return this;
69138
69243
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.13.34",
3
+ "version": "2.13.36",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -27,8 +27,8 @@
27
27
  "author": "abaplint",
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
- "@abaplint/core": "^2.119.55",
31
- "@abaplint/transpiler": "^2.13.34",
30
+ "@abaplint/core": "^2.119.56",
31
+ "@abaplint/transpiler": "^2.13.36",
32
32
  "@types/glob": "^8.1.0",
33
33
  "@types/node": "^24.12.2",
34
34
  "@types/progress": "^2.0.7",