@abaplint/transpiler-cli 2.10.10 → 2.10.12

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 +556 -115
  2. package/package.json +4 -4
package/build/bundle.js CHANGED
@@ -6428,7 +6428,7 @@ class SelectLoop extends combi_1.Expression {
6428
6428
  const packTab = (0, combi_1.seq)(pack, _1.SQLIntoTable);
6429
6429
  const into = (0, combi_1.altPrio)(sql_into_structure_1.SQLIntoStructure, _1.SQLIntoList);
6430
6430
  const perm = (0, combi_1.per)(_1.SQLFrom, where, sql_up_to_1.SQLUpTo, sql_order_by_1.SQLOrderBy, sql_having_1.SQLHaving, _1.SQLClient, bypass, _1.SQLGroupBy, _1.SQLForAllEntries, (0, combi_1.alt)(tab, into, packTab));
6431
- const strict = (0, combi_1.seq)(_1.SQLFrom, (0, combi_1.ver)(version_1.Version.v750, _1.SQLFields), where, into, sql_up_to_1.SQLUpTo);
6431
+ const strict = (0, combi_1.seq)(_1.SQLFrom, (0, combi_1.ver)(version_1.Version.v750, _1.SQLFields), (0, combi_1.optPrio)((0, combi_1.seq)(where, into, sql_up_to_1.SQLUpTo)));
6432
6432
  const ret = (0, combi_1.seq)("SELECT", (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.optPrio)("DISTINCT"), sql_field_list_loop_1.SQLFieldListLoop, perm), strict), (0, combi_1.optPrio)(sql_hints_1.SQLHints));
6433
6433
  return ret;
6434
6434
  }
@@ -34140,36 +34140,18 @@ exports.FlowGraph = FlowGraph;
34140
34140
 
34141
34141
  /***/ }),
34142
34142
 
34143
- /***/ "./node_modules/@abaplint/core/build/src/abap/flow/statement_flow.js":
34144
- /*!***************************************************************************!*\
34145
- !*** ./node_modules/@abaplint/core/build/src/abap/flow/statement_flow.js ***!
34146
- \***************************************************************************/
34143
+ /***/ "./node_modules/@abaplint/core/build/src/abap/flow/selection_events.js":
34144
+ /*!*****************************************************************************!*\
34145
+ !*** ./node_modules/@abaplint/core/build/src/abap/flow/selection_events.js ***!
34146
+ \*****************************************************************************/
34147
34147
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
34148
34148
 
34149
34149
  "use strict";
34150
34150
 
34151
34151
  Object.defineProperty(exports, "__esModule", ({ value: true }));
34152
- exports.StatementFlow = void 0;
34153
- const nodes_1 = __webpack_require__(/*! ../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
34154
- const Structures = __webpack_require__(/*! ../3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js");
34152
+ exports.DECLARATION_STUFF = exports.SELECTION_EVENTS = void 0;
34155
34153
  const Statements = __webpack_require__(/*! ../2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
34156
- const Expressions = __webpack_require__(/*! ../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
34157
- const flow_graph_1 = __webpack_require__(/*! ./flow_graph */ "./node_modules/@abaplint/core/build/src/abap/flow/flow_graph.js");
34158
- // Levels: top, FORM, METHOD, FUNCTION-MODULE, (MODULE, AT, END-OF-*, GET, START-OF-SELECTION, TOP-OF-PAGE)
34159
- //
34160
- // Loop branching: LOOP, DO, WHILE, SELECT(loop), WITH, PROVIDE
34161
- //
34162
- // Branching: IF, CASE, CASE TYPE OF, TRY, ON, CATCH SYSTEM-EXCEPTIONS, AT
34163
- //
34164
- // Conditional exits: CHECK, ASSERT
34165
- //
34166
- // Exits: RETURN, EXIT, RAISE(not RESUMABLE), MESSAGE(type E and A?), CONTINUE, REJECT, RESUME, STOP
34167
- //
34168
- // Not handled? INCLUDE + malplaced macro calls
34169
- /////////////////////////////////////
34170
- // TODO: handling static exceptions(only static), refactor some logic from UncaughtException to common file
34171
- // TODO: RAISE
34172
- const FLOW_EVENTS = [
34154
+ exports.SELECTION_EVENTS = [
34173
34155
  Statements.StartOfSelection,
34174
34156
  Statements.AtSelectionScreen,
34175
34157
  Statements.AtLineSelection,
@@ -34177,17 +34159,51 @@ const FLOW_EVENTS = [
34177
34159
  Statements.EndOfSelection,
34178
34160
  Statements.Initialization,
34179
34161
  Statements.TopOfPage,
34162
+ Statements.LoadOfProgram,
34180
34163
  Statements.EndOfPage,
34181
34164
  ];
34165
+ exports.DECLARATION_STUFF = [
34166
+ Statements.Data,
34167
+ Statements.DataBegin,
34168
+ Statements.Constant,
34169
+ Statements.Tables,
34170
+ Statements.Include, // this is not super correct, but anyhow
34171
+ Statements.Parameter,
34172
+ Statements.SelectionScreen,
34173
+ Statements.ConstantBegin,
34174
+ ];
34175
+ //# sourceMappingURL=selection_events.js.map
34176
+
34177
+ /***/ }),
34178
+
34179
+ /***/ "./node_modules/@abaplint/core/build/src/abap/flow/statement_flow.js":
34180
+ /*!***************************************************************************!*\
34181
+ !*** ./node_modules/@abaplint/core/build/src/abap/flow/statement_flow.js ***!
34182
+ \***************************************************************************/
34183
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
34184
+
34185
+ "use strict";
34186
+
34187
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
34188
+ exports.StatementFlow = void 0;
34189
+ const nodes_1 = __webpack_require__(/*! ../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
34190
+ const Structures = __webpack_require__(/*! ../3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js");
34191
+ const Statements = __webpack_require__(/*! ../2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
34192
+ const Expressions = __webpack_require__(/*! ../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
34193
+ const flow_graph_1 = __webpack_require__(/*! ./flow_graph */ "./node_modules/@abaplint/core/build/src/abap/flow/flow_graph.js");
34194
+ const objects_1 = __webpack_require__(/*! ../../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
34195
+ const selection_events_1 = __webpack_require__(/*! ./selection_events */ "./node_modules/@abaplint/core/build/src/abap/flow/selection_events.js");
34182
34196
  class StatementFlow {
34183
34197
  constructor() {
34184
34198
  this.counter = 0;
34185
34199
  }
34186
- build(stru) {
34200
+ build(stru, obj) {
34187
34201
  var _a, _b, _c, _d;
34188
34202
  const ret = [];
34189
34203
  let name = "";
34190
- const structures = stru.findAllStructuresMulti([Structures.Form, Structures.ClassImplementation, Structures.FunctionModule]);
34204
+ const structures = stru.findAllStructuresMulti([
34205
+ Structures.Form, Structures.ClassImplementation, Structures.FunctionModule, Structures.Module
34206
+ ]);
34191
34207
  for (const s of structures) {
34192
34208
  if (s.get() instanceof Structures.Form) {
34193
34209
  name = "FORM " + ((_a = s.findFirstExpression(Expressions.FormName)) === null || _a === void 0 ? void 0 : _a.concatTokens());
@@ -34205,40 +34221,46 @@ class StatementFlow {
34205
34221
  name = "FUNCTION " + ((_d = s.findFirstExpression(Expressions.Field)) === null || _d === void 0 ? void 0 : _d.concatTokens());
34206
34222
  ret.push(this.run(s, name));
34207
34223
  }
34224
+ else if (s.get() instanceof Structures.Module) {
34225
+ name = s.getFirstStatement().concatTokens().toUpperCase();
34226
+ ret.push(this.run(s, name));
34227
+ }
34208
34228
  else {
34209
34229
  throw new Error("StatementFlow, unknown structure");
34210
34230
  }
34211
34231
  }
34212
- // find the top level events
34213
- let inFlow = false;
34214
- let collected = [];
34215
- for (const s of stru.getChildren() || []) {
34216
- if (FLOW_EVENTS.some(f => s.get() instanceof f)) {
34217
- if (inFlow === true) {
34218
- ret.push(this.runEvent(collected, name));
34232
+ if (obj instanceof objects_1.Program) {
34233
+ // find the top level events
34234
+ let inEvent = false;
34235
+ let collected = [];
34236
+ for (const s of stru.getChildren() || []) {
34237
+ if (selection_events_1.SELECTION_EVENTS.some(f => s.get() instanceof f)) {
34238
+ if (inEvent === true) {
34239
+ ret.push(this.runEvent(collected, name));
34240
+ }
34241
+ collected = [];
34242
+ inEvent = true;
34243
+ name = s.concatTokens();
34244
+ }
34245
+ else if (s.get() instanceof Structures.Normal) {
34246
+ collected.push(s);
34247
+ }
34248
+ else {
34249
+ if (inEvent === true) {
34250
+ ret.push(this.runEvent(collected, name));
34251
+ inEvent = false;
34252
+ }
34253
+ collected = [];
34219
34254
  }
34220
- collected = [];
34221
- inFlow = true;
34222
- name = s.concatTokens();
34223
34255
  }
34224
- else if (s.get() instanceof Structures.Normal) {
34225
- collected.push(s);
34256
+ if (inEvent === true) {
34257
+ ret.push(this.runEvent(collected, name));
34226
34258
  }
34227
- else {
34228
- if (inFlow === true) {
34229
- ret.push(this.runEvent(collected, name));
34230
- inFlow = false;
34231
- }
34232
- collected = [];
34259
+ else if (collected.length > 0) {
34260
+ // implicit START-OF-SELECTION
34261
+ ret.push(this.runEvent(collected, "START-OF-SELECTION."));
34233
34262
  }
34234
34263
  }
34235
- if (inFlow === true) {
34236
- ret.push(this.runEvent(collected, name));
34237
- }
34238
- else if (collected.length > 0) {
34239
- // implicit START-OF-SELECTION
34240
- ret.push(this.runEvent(collected, "START-OF-SELECTION."));
34241
- }
34242
34264
  return ret.map(f => f.reduce());
34243
34265
  }
34244
34266
  ////////////////////
@@ -34385,6 +34407,7 @@ class StatementFlow {
34385
34407
  graph.addEdge(loopName, graph.getEnd(), flow_graph_1.FLOW_EDGE_TYPE.false);
34386
34408
  }
34387
34409
  else if (type instanceof Structures.Data
34410
+ || type instanceof Structures.Constants
34388
34411
  || type instanceof Structures.Types) {
34389
34412
  // these doesnt affect control flow, so just take the first statement
34390
34413
  const statement = n.getFirstStatement();
@@ -41397,8 +41420,10 @@ const _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identif
41397
41420
  const _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
41398
41421
  const _builtin_1 = __webpack_require__(/*! ../abap/5_syntax/_builtin */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js");
41399
41422
  const _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js");
41423
+ const objects_1 = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
41400
41424
  const types_1 = __webpack_require__(/*! ../abap/types */ "./node_modules/@abaplint/core/build/src/abap/types/index.js");
41401
41425
  const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
41426
+ const include_graph_1 = __webpack_require__(/*! ../utils/include_graph */ "./node_modules/@abaplint/core/build/src/utils/include_graph.js");
41402
41427
  class LSPLookup {
41403
41428
  static lookup(cursor, reg, obj) {
41404
41429
  var _a, _b;
@@ -41411,7 +41436,17 @@ class LSPLookup {
41411
41436
  if (fm) {
41412
41437
  return { hover: "Function Module " + fm };
41413
41438
  }
41414
- const bottomScope = new syntax_1.SyntaxLogic(reg, obj).run().spaghetti.lookupPosition(cursor.identifier.getStart(), cursor.identifier.getFilename());
41439
+ let main = obj;
41440
+ if (obj instanceof objects_1.Program && obj.isInclude()) {
41441
+ // todo: this is slow
41442
+ const ig = new include_graph_1.IncludeGraph(reg);
41443
+ const mains = ig.listMainForInclude(cursor.identifier.getFilename());
41444
+ if (mains.length === 1) {
41445
+ // yea, well, or it has to be a popup
41446
+ main = reg.findObjectForFile(reg.getFileByName(mains[0])) || obj;
41447
+ }
41448
+ }
41449
+ const bottomScope = new syntax_1.SyntaxLogic(reg, main).run().spaghetti.lookupPosition(cursor.identifier.getStart(), cursor.identifier.getFilename());
41415
41450
  if (bottomScope === undefined) {
41416
41451
  return undefined;
41417
41452
  }
@@ -42945,11 +42980,15 @@ class LanguageServer {
42945
42980
  if (file === undefined) {
42946
42981
  return "file not found";
42947
42982
  }
42983
+ const obj = this.reg.findObjectForFile(file);
42984
+ if (obj === undefined) {
42985
+ return "obj not found";
42986
+ }
42948
42987
  const stru = file.getStructure();
42949
42988
  if (stru === undefined) {
42950
42989
  return "empty structure";
42951
42990
  }
42952
- const graphs = new statement_flow_1.StatementFlow().build(stru);
42991
+ const graphs = new statement_flow_1.StatementFlow().build(stru, obj);
42953
42992
  const wiz = graphs.map(g => g.toDigraph());
42954
42993
  return JSON.stringify(wiz);
42955
42994
  }
@@ -43814,6 +43853,45 @@ exports.AbstractObject = AbstractObject;
43814
43853
 
43815
43854
  /***/ }),
43816
43855
 
43856
+ /***/ "./node_modules/@abaplint/core/build/src/objects/_dynpros.js":
43857
+ /*!*******************************************************************!*\
43858
+ !*** ./node_modules/@abaplint/core/build/src/objects/_dynpros.js ***!
43859
+ \*******************************************************************/
43860
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
43861
+
43862
+ "use strict";
43863
+
43864
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
43865
+ exports.parseDynpros = parseDynpros;
43866
+ const xml_utils_1 = __webpack_require__(/*! ../xml_utils */ "./node_modules/@abaplint/core/build/src/xml_utils.js");
43867
+ function parseDynpros(parsed) {
43868
+ var _a, _b, _c, _d;
43869
+ const dynpros = [];
43870
+ const xmlDynpros = (_c = (_b = (_a = parsed.abapGit) === null || _a === void 0 ? void 0 : _a["asx:abap"]) === null || _b === void 0 ? void 0 : _b["asx:values"]) === null || _c === void 0 ? void 0 : _c.DYNPROS;
43871
+ if (xmlDynpros !== undefined) {
43872
+ for (const d of (0, xml_utils_1.xmlToArray)(xmlDynpros.item)) {
43873
+ const fields = [];
43874
+ for (const f of (0, xml_utils_1.xmlToArray)((_d = d.FIELDS) === null || _d === void 0 ? void 0 : _d.RPY_DYFATC)) {
43875
+ fields.push({
43876
+ name: f.NAME,
43877
+ type: f.TYPE,
43878
+ length: f.LENGTH,
43879
+ });
43880
+ }
43881
+ dynpros.push({
43882
+ number: d.HEADER.SCREEN,
43883
+ description: d.HEADER.DESCRIPT,
43884
+ nextScreen: d.HEADER.NEXTSCREEN,
43885
+ fields: fields,
43886
+ });
43887
+ }
43888
+ }
43889
+ return dynpros;
43890
+ }
43891
+ //# sourceMappingURL=_dynpros.js.map
43892
+
43893
+ /***/ }),
43894
+
43817
43895
  /***/ "./node_modules/@abaplint/core/build/src/objects/_unknown_object.js":
43818
43896
  /*!**************************************************************************!*\
43819
43897
  !*** ./node_modules/@abaplint/core/build/src/objects/_unknown_object.js ***!
@@ -45505,6 +45583,7 @@ class DataElement extends _abstract_object_1.AbstractObject {
45505
45583
  }
45506
45584
  getDescription() {
45507
45585
  var _a;
45586
+ this.parse();
45508
45587
  return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.description;
45509
45588
  }
45510
45589
  getAllowedNaming() {
@@ -45522,6 +45601,11 @@ class DataElement extends _abstract_object_1.AbstractObject {
45522
45601
  this.parse();
45523
45602
  return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.domname;
45524
45603
  }
45604
+ getTexts() {
45605
+ var _a;
45606
+ this.parse();
45607
+ return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.texts;
45608
+ }
45525
45609
  parseType(reg) {
45526
45610
  const references = [];
45527
45611
  let lookup = undefined;
@@ -45580,6 +45664,12 @@ class DataElement extends _abstract_object_1.AbstractObject {
45580
45664
  datatype: dd04v === null || dd04v === void 0 ? void 0 : dd04v.DATATYPE,
45581
45665
  leng: dd04v === null || dd04v === void 0 ? void 0 : dd04v.LENG,
45582
45666
  decimals: dd04v === null || dd04v === void 0 ? void 0 : dd04v.DECIMALS,
45667
+ texts: {
45668
+ short: dd04v === null || dd04v === void 0 ? void 0 : dd04v.SCRTEXT_S,
45669
+ medium: dd04v === null || dd04v === void 0 ? void 0 : dd04v.SCRTEXT_M,
45670
+ long: dd04v === null || dd04v === void 0 ? void 0 : dd04v.SCRTEXT_L,
45671
+ heading: dd04v === null || dd04v === void 0 ? void 0 : dd04v.REPTEXT,
45672
+ },
45583
45673
  };
45584
45674
  const end = Date.now();
45585
45675
  return { updated: true, runtime: end - start };
@@ -46217,18 +46307,23 @@ const _abap_object_1 = __webpack_require__(/*! ./_abap_object */ "./node_modules
46217
46307
  const types_1 = __webpack_require__(/*! ../abap/types */ "./node_modules/@abaplint/core/build/src/abap/types/index.js");
46218
46308
  const xml_utils_1 = __webpack_require__(/*! ../xml_utils */ "./node_modules/@abaplint/core/build/src/xml_utils.js");
46219
46309
  const fast_xml_parser_1 = __webpack_require__(/*! fast-xml-parser */ "./node_modules/fast-xml-parser/src/fxp.js");
46310
+ const _dynpros_1 = __webpack_require__(/*! ./_dynpros */ "./node_modules/@abaplint/core/build/src/objects/_dynpros.js");
46220
46311
  class FunctionGroup extends _abap_object_1.ABAPObject {
46221
46312
  constructor() {
46222
46313
  super(...arguments);
46223
46314
  this.includes = undefined;
46224
46315
  this.modules = undefined;
46316
+ this.description = undefined;
46317
+ this.dynpros = undefined;
46225
46318
  }
46226
46319
  getType() {
46227
46320
  return "FUGR";
46228
46321
  }
46229
46322
  getDescription() {
46230
- // todo
46231
- return undefined;
46323
+ if (this.description === undefined) {
46324
+ this.parseXML();
46325
+ }
46326
+ return this.description;
46232
46327
  }
46233
46328
  setDirty() {
46234
46329
  super.setDirty();
@@ -46241,6 +46336,12 @@ class FunctionGroup extends _abap_object_1.ABAPObject {
46241
46336
  allowNamespace: true,
46242
46337
  };
46243
46338
  }
46339
+ getDynpros() {
46340
+ if (this.dynpros === undefined) {
46341
+ this.parseXML();
46342
+ }
46343
+ return this.dynpros || [];
46344
+ }
46244
46345
  getSequencedFiles() {
46245
46346
  const main = this.getMainABAPFile();
46246
46347
  if (main === undefined) {
@@ -46342,22 +46443,24 @@ class FunctionGroup extends _abap_object_1.ABAPObject {
46342
46443
  }
46343
46444
  /////////////////////////////////
46344
46445
  parseXML() {
46345
- var _a, _b;
46446
+ var _a, _b, _c;
46346
46447
  this.includes = [];
46347
46448
  this.modules = [];
46348
46449
  const parsed = this.parseRaw2();
46349
46450
  if (parsed === undefined) {
46350
46451
  return;
46351
46452
  }
46453
+ this.description = (_a = parsed.abapGit["asx:abap"]["asx:values"]) === null || _a === void 0 ? void 0 : _a.AREAT;
46454
+ this.dynpros = (0, _dynpros_1.parseDynpros)(parsed);
46352
46455
  // INCLUDES
46353
- const includes = (_a = parsed.abapGit["asx:abap"]["asx:values"]) === null || _a === void 0 ? void 0 : _a.INCLUDES;
46456
+ const includes = (_b = parsed.abapGit["asx:abap"]["asx:values"]) === null || _b === void 0 ? void 0 : _b.INCLUDES;
46354
46457
  if (includes !== undefined) {
46355
46458
  for (const i of (0, xml_utils_1.xmlToArray)(includes.SOBJ_NAME)) {
46356
46459
  this.includes.push(i);
46357
46460
  }
46358
46461
  }
46359
46462
  // FUNCTION MODULES
46360
- const functions = (_b = parsed.abapGit["asx:abap"]["asx:values"]) === null || _b === void 0 ? void 0 : _b.FUNCTIONS;
46463
+ const functions = (_c = parsed.abapGit["asx:abap"]["asx:values"]) === null || _c === void 0 ? void 0 : _c.FUNCTIONS;
46361
46464
  for (const module of (0, xml_utils_1.xmlToArray)(functions === null || functions === void 0 ? void 0 : functions.item)) {
46362
46465
  this.modules.push(new types_1.FunctionModuleDefinition(module));
46363
46466
  }
@@ -48716,7 +48819,7 @@ exports.PersonalizationObject = PersonalizationObject;
48716
48819
  Object.defineProperty(exports, "__esModule", ({ value: true }));
48717
48820
  exports.Program = void 0;
48718
48821
  const _abap_object_1 = __webpack_require__(/*! ./_abap_object */ "./node_modules/@abaplint/core/build/src/objects/_abap_object.js");
48719
- const xml_utils_1 = __webpack_require__(/*! ../xml_utils */ "./node_modules/@abaplint/core/build/src/xml_utils.js");
48822
+ const _dynpros_1 = __webpack_require__(/*! ./_dynpros */ "./node_modules/@abaplint/core/build/src/objects/_dynpros.js");
48720
48823
  class Program extends _abap_object_1.ABAPObject {
48721
48824
  getType() {
48722
48825
  return "PROG";
@@ -48752,11 +48855,10 @@ class Program extends _abap_object_1.ABAPObject {
48752
48855
  }
48753
48856
  getDynpros() {
48754
48857
  this.parseXML();
48755
- return this.parsedXML.dynpros;
48858
+ return this.parsedXML.dynpros || [];
48756
48859
  }
48757
48860
  ////////////////////////////
48758
48861
  parseXML() {
48759
- var _a, _b, _c, _d;
48760
48862
  if (this.parsedXML !== undefined) {
48761
48863
  return;
48762
48864
  }
@@ -48770,24 +48872,7 @@ class Program extends _abap_object_1.ABAPObject {
48770
48872
  };
48771
48873
  return;
48772
48874
  }
48773
- const dynpros = [];
48774
- const xmlDynpros = (_c = (_b = (_a = parsed.abapGit) === null || _a === void 0 ? void 0 : _a["asx:abap"]) === null || _b === void 0 ? void 0 : _b["asx:values"]) === null || _c === void 0 ? void 0 : _c.DYNPROS;
48775
- if (xmlDynpros !== undefined) {
48776
- for (const d of (0, xml_utils_1.xmlToArray)(xmlDynpros.item)) {
48777
- const fields = [];
48778
- for (const f of (0, xml_utils_1.xmlToArray)((_d = d.FIELDS) === null || _d === void 0 ? void 0 : _d.RPY_DYFATC)) {
48779
- fields.push({
48780
- name: f.NAME,
48781
- type: f.TYPE,
48782
- length: f.LENGTH,
48783
- });
48784
- }
48785
- dynpros.push({
48786
- number: d.HEADER.SCREEN,
48787
- fields: fields,
48788
- });
48789
- }
48790
- }
48875
+ const dynpros = (0, _dynpros_1.parseDynpros)(parsed);
48791
48876
  this.parsedXML = {
48792
48877
  isInclude: file ? file.getRaw().includes("<SUBC>I</SUBC>") : false,
48793
48878
  isModulePool: file ? file.getRaw().includes("<SUBC>M</SUBC>") : false,
@@ -51564,7 +51649,7 @@ class Registry {
51564
51649
  }
51565
51650
  static abaplintVersion() {
51566
51651
  // magic, see build script "version.sh"
51567
- return "2.112.22";
51652
+ return "2.113.6";
51568
51653
  }
51569
51654
  getDDICReferences() {
51570
51655
  return this.ddicReferences;
@@ -52202,6 +52287,111 @@ exports.Abapdoc = Abapdoc;
52202
52287
 
52203
52288
  /***/ }),
52204
52289
 
52290
+ /***/ "./node_modules/@abaplint/core/build/src/rules/add_test_attributes.js":
52291
+ /*!****************************************************************************!*\
52292
+ !*** ./node_modules/@abaplint/core/build/src/rules/add_test_attributes.js ***!
52293
+ \****************************************************************************/
52294
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
52295
+
52296
+ "use strict";
52297
+
52298
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
52299
+ exports.AddTestAttributes = exports.AddTestAttributesConf = void 0;
52300
+ const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
52301
+ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
52302
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
52303
+ const Statements = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
52304
+ const Structures = __webpack_require__(/*! ../abap/3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js");
52305
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
52306
+ class AddTestAttributesConf extends _basic_rule_config_1.BasicRuleConfig {
52307
+ }
52308
+ exports.AddTestAttributesConf = AddTestAttributesConf;
52309
+ class AddTestAttributes extends _abap_rule_1.ABAPRule {
52310
+ constructor() {
52311
+ super(...arguments);
52312
+ this.conf = new AddTestAttributesConf();
52313
+ }
52314
+ getMetadata() {
52315
+ return {
52316
+ key: "add_test_attributes",
52317
+ title: "Add test attributes for tests classes with test methods",
52318
+ shortDescription: `Add test attributes DURATION and RISK LEVEL for tests classes with test methods`,
52319
+ tags: [_irule_1.RuleTag.SingleFile],
52320
+ badExample: `CLASS ltcl_test1 DEFINITION FINAL FOR TESTING.
52321
+ PUBLIC SECTION.
52322
+ PROTECTED SECTION.
52323
+ PRIVATE SECTION.
52324
+ METHODS test FOR TESTING RAISING cx_static_check.
52325
+ ENDCLASS.
52326
+
52327
+ CLASS ltcl_test1 IMPLEMENTATION.
52328
+ METHOD test.
52329
+ ENDMETHOD.
52330
+ ENDCLASS.`,
52331
+ goodExample: `CLASS ltcl_test2 DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
52332
+ PUBLIC SECTION.
52333
+ PROTECTED SECTION.
52334
+ PRIVATE SECTION.
52335
+ METHODS test FOR TESTING RAISING cx_static_check.
52336
+ ENDCLASS.
52337
+
52338
+ CLASS ltcl_test2 IMPLEMENTATION.
52339
+ METHOD test.
52340
+ ENDMETHOD.
52341
+ ENDCLASS.`,
52342
+ };
52343
+ }
52344
+ getConfig() {
52345
+ return this.conf;
52346
+ }
52347
+ setConfig(conf) {
52348
+ this.conf = conf;
52349
+ }
52350
+ runParsed(file) {
52351
+ const issues = [];
52352
+ const stru = file.getStructure();
52353
+ if (stru === undefined) {
52354
+ return [];
52355
+ }
52356
+ for (const classStructure of stru.findAllStructures(Structures.ClassDefinition)) {
52357
+ const cdef = classStructure.findFirstStatement(Statements.ClassDefinition);
52358
+ if (cdef === undefined) {
52359
+ continue;
52360
+ }
52361
+ const cdefConcat = cdef === null || cdef === void 0 ? void 0 : cdef.concatTokens().toUpperCase();
52362
+ if ((cdefConcat === null || cdefConcat === void 0 ? void 0 : cdefConcat.includes(" FOR TESTING")) === false) {
52363
+ continue;
52364
+ }
52365
+ const hasDuration = cdefConcat === null || cdefConcat === void 0 ? void 0 : cdefConcat.includes(" DURATION ");
52366
+ const hasRiskLevel = cdefConcat === null || cdefConcat === void 0 ? void 0 : cdefConcat.includes(" RISK LEVEL ");
52367
+ if (hasDuration === true && hasRiskLevel === true) {
52368
+ continue;
52369
+ }
52370
+ let hasTestMethod = false;
52371
+ for (const mdef of classStructure.findAllStatements(Statements.MethodDef)) {
52372
+ const concat = mdef.concatTokens().toUpperCase();
52373
+ if (concat.includes(" FOR TESTING")) {
52374
+ hasTestMethod = true;
52375
+ }
52376
+ }
52377
+ if (hasTestMethod === false) {
52378
+ continue;
52379
+ }
52380
+ if (hasDuration === false) {
52381
+ issues.push(issue_1.Issue.atStatement(file, cdef, "Add DURATION", this.getMetadata().key, this.getConfig().severity));
52382
+ }
52383
+ if (hasRiskLevel === false) {
52384
+ issues.push(issue_1.Issue.atStatement(file, cdef, "Add RISK LEVEL", this.getMetadata().key, this.getConfig().severity));
52385
+ }
52386
+ }
52387
+ return issues;
52388
+ }
52389
+ }
52390
+ exports.AddTestAttributes = AddTestAttributes;
52391
+ //# sourceMappingURL=add_test_attributes.js.map
52392
+
52393
+ /***/ }),
52394
+
52205
52395
  /***/ "./node_modules/@abaplint/core/build/src/rules/align_parameters.js":
52206
52396
  /*!*************************************************************************!*\
52207
52397
  !*** ./node_modules/@abaplint/core/build/src/rules/align_parameters.js ***!
@@ -59625,6 +59815,100 @@ exports.EasyToFindMessages = EasyToFindMessages;
59625
59815
 
59626
59816
  /***/ }),
59627
59817
 
59818
+ /***/ "./node_modules/@abaplint/core/build/src/rules/empty_event.js":
59819
+ /*!********************************************************************!*\
59820
+ !*** ./node_modules/@abaplint/core/build/src/rules/empty_event.js ***!
59821
+ \********************************************************************/
59822
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
59823
+
59824
+ "use strict";
59825
+
59826
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
59827
+ exports.EmptyEvent = exports.EmptyEventConf = void 0;
59828
+ const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
59829
+ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
59830
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
59831
+ const Structures = __webpack_require__(/*! ../abap/3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js");
59832
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
59833
+ const objects_1 = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
59834
+ const selection_events_1 = __webpack_require__(/*! ../abap/flow/selection_events */ "./node_modules/@abaplint/core/build/src/abap/flow/selection_events.js");
59835
+ class EmptyEventConf extends _basic_rule_config_1.BasicRuleConfig {
59836
+ }
59837
+ exports.EmptyEventConf = EmptyEventConf;
59838
+ class EmptyEvent extends _abap_rule_1.ABAPRule {
59839
+ constructor() {
59840
+ super(...arguments);
59841
+ this.conf = new EmptyEventConf();
59842
+ }
59843
+ getMetadata() {
59844
+ return {
59845
+ key: "empty_event",
59846
+ title: "Empty selection screen or list processing event block",
59847
+ shortDescription: `Empty selection screen or list processing event block`,
59848
+ extendedInformation: ``,
59849
+ tags: [_irule_1.RuleTag.SingleFile],
59850
+ badExample: `
59851
+ INITIALIZATION.
59852
+ WRITE 'hello'.
59853
+ END-OF-SELECTION.`,
59854
+ goodExample: `
59855
+ START-OF-SELECTION.
59856
+ PERFORM sdf.
59857
+ COMMIT WORK.`,
59858
+ };
59859
+ }
59860
+ getConfig() {
59861
+ return this.conf;
59862
+ }
59863
+ setConfig(conf) {
59864
+ this.conf = conf;
59865
+ }
59866
+ runParsed(file, obj) {
59867
+ const issues = [];
59868
+ if (!(obj instanceof objects_1.Program) || obj.isInclude()) {
59869
+ return issues;
59870
+ }
59871
+ const stru = file.getStructure();
59872
+ if (stru === undefined) {
59873
+ return [];
59874
+ }
59875
+ let currentEvent = undefined;
59876
+ let children = [];
59877
+ for (const s of stru.getChildren() || []) {
59878
+ if (selection_events_1.SELECTION_EVENTS.some(f => s.get() instanceof f)) {
59879
+ if (currentEvent !== undefined && children.length === 0) {
59880
+ issues.push(issue_1.Issue.atStatement(file, currentEvent, "Empty event", this.getMetadata().key, this.getConfig().severity));
59881
+ }
59882
+ children = [];
59883
+ currentEvent = s;
59884
+ }
59885
+ else if (s.get() instanceof Structures.Normal) {
59886
+ const stru = s;
59887
+ // ignore declaration stuff
59888
+ if (selection_events_1.DECLARATION_STUFF.some(d => { var _a; return ((_a = stru.getFirstStatement()) === null || _a === void 0 ? void 0 : _a.get()) instanceof d; })) {
59889
+ continue;
59890
+ }
59891
+ children.push(s);
59892
+ }
59893
+ else {
59894
+ if (currentEvent !== undefined && children.length === 0) {
59895
+ issues.push(issue_1.Issue.atStatement(file, currentEvent, "Empty event", this.getMetadata().key, this.getConfig().severity));
59896
+ }
59897
+ children = [];
59898
+ currentEvent = undefined;
59899
+ }
59900
+ }
59901
+ if (currentEvent !== undefined && children.length === 0) {
59902
+ issues.push(issue_1.Issue.atStatement(file, currentEvent, "Empty event", this.getMetadata().key, this.getConfig().severity));
59903
+ }
59904
+ return issues;
59905
+ }
59906
+ }
59907
+ exports.EmptyEvent = EmptyEvent;
59908
+ //# sourceMappingURL=empty_event.js.map
59909
+
59910
+ /***/ }),
59911
+
59628
59912
  /***/ "./node_modules/@abaplint/core/build/src/rules/empty_line_in_statement.js":
59629
59913
  /*!********************************************************************************!*\
59630
59914
  !*** ./node_modules/@abaplint/core/build/src/rules/empty_line_in_statement.js ***!
@@ -61991,6 +62275,109 @@ exports.ImplementMethods = ImplementMethods;
61991
62275
 
61992
62276
  /***/ }),
61993
62277
 
62278
+ /***/ "./node_modules/@abaplint/core/build/src/rules/implicit_start_of_selection.js":
62279
+ /*!************************************************************************************!*\
62280
+ !*** ./node_modules/@abaplint/core/build/src/rules/implicit_start_of_selection.js ***!
62281
+ \************************************************************************************/
62282
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
62283
+
62284
+ "use strict";
62285
+
62286
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
62287
+ exports.ImplicitStartOfSelection = exports.ImplicitStartOfSelectionConf = void 0;
62288
+ const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
62289
+ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
62290
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
62291
+ const Structures = __webpack_require__(/*! ../abap/3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js");
62292
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
62293
+ const objects_1 = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
62294
+ const nodes_1 = __webpack_require__(/*! ../abap/nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
62295
+ const selection_events_1 = __webpack_require__(/*! ../abap/flow/selection_events */ "./node_modules/@abaplint/core/build/src/abap/flow/selection_events.js");
62296
+ class ImplicitStartOfSelectionConf extends _basic_rule_config_1.BasicRuleConfig {
62297
+ }
62298
+ exports.ImplicitStartOfSelectionConf = ImplicitStartOfSelectionConf;
62299
+ class ImplicitStartOfSelection extends _abap_rule_1.ABAPRule {
62300
+ constructor() {
62301
+ super(...arguments);
62302
+ this.conf = new ImplicitStartOfSelectionConf();
62303
+ }
62304
+ getMetadata() {
62305
+ return {
62306
+ key: "implicit_start_of_selection",
62307
+ title: "Implicit START-OF-SELECTION",
62308
+ shortDescription: `Add explicit selection screen event handling`,
62309
+ extendedInformation: `Only runs for executable programs
62310
+
62311
+ https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapstart-of-selection.htm`,
62312
+ tags: [_irule_1.RuleTag.SingleFile],
62313
+ badExample: `REPORT zfoo.
62314
+ WRITE 'hello'.`,
62315
+ goodExample: `
62316
+ START-OF-SELECTION.
62317
+ WRITE 'hello'.`,
62318
+ };
62319
+ }
62320
+ getConfig() {
62321
+ return this.conf;
62322
+ }
62323
+ setConfig(conf) {
62324
+ this.conf = conf;
62325
+ }
62326
+ runParsed(file, obj) {
62327
+ const issues = [];
62328
+ if (!(obj instanceof objects_1.Program) || obj.isInclude()) {
62329
+ return issues;
62330
+ }
62331
+ const stru = file.getStructure();
62332
+ if (stru === undefined) {
62333
+ return [];
62334
+ }
62335
+ let inEvent = false;
62336
+ let collected = [];
62337
+ for (const s of stru.getChildren() || []) {
62338
+ if (selection_events_1.SELECTION_EVENTS.some(f => s.get() instanceof f)) {
62339
+ if (inEvent === false && collected.length > 0) {
62340
+ // implicit START-OF-SELECTION
62341
+ let first = collected[0];
62342
+ if (first instanceof nodes_1.StructureNode) {
62343
+ first = first.getFirstStatement();
62344
+ }
62345
+ issues.push(issue_1.Issue.atStatement(file, first, "Implicit START-OF-SELECTION", this.getMetadata().key, this.getConfig().severity));
62346
+ }
62347
+ collected = [];
62348
+ inEvent = true;
62349
+ }
62350
+ else if (s.get() instanceof Structures.Normal) {
62351
+ const stru = s;
62352
+ // ignore declaration stuff
62353
+ if (selection_events_1.DECLARATION_STUFF.some(d => { var _a; return ((_a = stru.getFirstStatement()) === null || _a === void 0 ? void 0 : _a.get()) instanceof d; })) {
62354
+ continue;
62355
+ }
62356
+ collected.push(s);
62357
+ }
62358
+ else {
62359
+ if (inEvent === true) {
62360
+ inEvent = false;
62361
+ }
62362
+ collected = [];
62363
+ }
62364
+ }
62365
+ if (inEvent === false && collected.length > 0) {
62366
+ // implicit START-OF-SELECTION
62367
+ let first = collected[0];
62368
+ if (first instanceof nodes_1.StructureNode) {
62369
+ first = first.getFirstStatement();
62370
+ }
62371
+ issues.push(issue_1.Issue.atStatement(file, first, "Implicit START-OF-SELECTION", this.getMetadata().key, this.getConfig().severity));
62372
+ }
62373
+ return issues;
62374
+ }
62375
+ }
62376
+ exports.ImplicitStartOfSelection = ImplicitStartOfSelection;
62377
+ //# sourceMappingURL=implicit_start_of_selection.js.map
62378
+
62379
+ /***/ }),
62380
+
61994
62381
  /***/ "./node_modules/@abaplint/core/build/src/rules/in_statement_indentation.js":
61995
62382
  /*!*********************************************************************************!*\
61996
62383
  !*** ./node_modules/@abaplint/core/build/src/rules/in_statement_indentation.js ***!
@@ -62294,6 +62681,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
62294
62681
  Object.defineProperty(exports, "__esModule", ({ value: true }));
62295
62682
  __exportStar(__webpack_require__(/*! ./7bit_ascii */ "./node_modules/@abaplint/core/build/src/rules/7bit_ascii.js"), exports);
62296
62683
  __exportStar(__webpack_require__(/*! ./abapdoc */ "./node_modules/@abaplint/core/build/src/rules/abapdoc.js"), exports);
62684
+ __exportStar(__webpack_require__(/*! ./add_test_attributes */ "./node_modules/@abaplint/core/build/src/rules/add_test_attributes.js"), exports);
62297
62685
  __exportStar(__webpack_require__(/*! ./align_parameters */ "./node_modules/@abaplint/core/build/src/rules/align_parameters.js"), exports);
62298
62686
  __exportStar(__webpack_require__(/*! ./align_pseudo_comments */ "./node_modules/@abaplint/core/build/src/rules/align_pseudo_comments.js"), exports);
62299
62687
  __exportStar(__webpack_require__(/*! ./align_type_expressions */ "./node_modules/@abaplint/core/build/src/rules/align_type_expressions.js"), exports);
@@ -62335,6 +62723,7 @@ __exportStar(__webpack_require__(/*! ./double_space */ "./node_modules/@abaplint
62335
62723
  __exportStar(__webpack_require__(/*! ./downport */ "./node_modules/@abaplint/core/build/src/rules/downport.js"), exports);
62336
62724
  __exportStar(__webpack_require__(/*! ./dynpro_checks */ "./node_modules/@abaplint/core/build/src/rules/dynpro_checks.js"), exports);
62337
62725
  __exportStar(__webpack_require__(/*! ./easy_to_find_messages */ "./node_modules/@abaplint/core/build/src/rules/easy_to_find_messages.js"), exports);
62726
+ __exportStar(__webpack_require__(/*! ./empty_event */ "./node_modules/@abaplint/core/build/src/rules/empty_event.js"), exports);
62338
62727
  __exportStar(__webpack_require__(/*! ./empty_line_in_statement */ "./node_modules/@abaplint/core/build/src/rules/empty_line_in_statement.js"), exports);
62339
62728
  __exportStar(__webpack_require__(/*! ./empty_statement */ "./node_modules/@abaplint/core/build/src/rules/empty_statement.js"), exports);
62340
62729
  __exportStar(__webpack_require__(/*! ./empty_structure */ "./node_modules/@abaplint/core/build/src/rules/empty_structure.js"), exports);
@@ -62356,6 +62745,7 @@ __exportStar(__webpack_require__(/*! ./identical_descriptions */ "./node_modules
62356
62745
  __exportStar(__webpack_require__(/*! ./identical_form_names */ "./node_modules/@abaplint/core/build/src/rules/identical_form_names.js"), exports);
62357
62746
  __exportStar(__webpack_require__(/*! ./if_in_if */ "./node_modules/@abaplint/core/build/src/rules/if_in_if.js"), exports);
62358
62747
  __exportStar(__webpack_require__(/*! ./implement_methods */ "./node_modules/@abaplint/core/build/src/rules/implement_methods.js"), exports);
62748
+ __exportStar(__webpack_require__(/*! ./implicit_start_of_selection */ "./node_modules/@abaplint/core/build/src/rules/implicit_start_of_selection.js"), exports);
62359
62749
  __exportStar(__webpack_require__(/*! ./in_statement_indentation */ "./node_modules/@abaplint/core/build/src/rules/in_statement_indentation.js"), exports);
62360
62750
  __exportStar(__webpack_require__(/*! ./indentation */ "./node_modules/@abaplint/core/build/src/rules/indentation.js"), exports);
62361
62751
  __exportStar(__webpack_require__(/*! ./inline_data_old_versions */ "./node_modules/@abaplint/core/build/src/rules/inline_data_old_versions.js"), exports);
@@ -76160,7 +76550,7 @@ class FieldChainTranspiler {
76160
76550
  if (c.get() instanceof core_1.Expressions.SourceField
76161
76551
  || c.get() instanceof core_1.Expressions.Field) {
76162
76552
  const name = traversal.prefixAndName(c.getFirstToken(), filename).replace("~", "$");
76163
- ret.append(traversal_1.Traversal.escapeNamespace(name), c, traversal);
76553
+ ret.append(traversal_1.Traversal.prefixVariable(traversal_1.Traversal.escapeNamespace(name)), c, traversal);
76164
76554
  }
76165
76555
  else if (c instanceof core_1.Nodes.ExpressionNode && c.get() instanceof core_1.Expressions.SourceFieldSymbol) {
76166
76556
  ret.appendChunk(new field_symbol_1.FieldSymbolTranspiler().transpile(c, traversal));
@@ -78098,7 +78488,7 @@ class TargetTranspiler {
78098
78488
  const next = children[i + 1];
78099
78489
  if (c.get() instanceof core_1.Expressions.TargetField) {
78100
78490
  const prefix = traversal.prefixAndName(c.getFirstToken()).replace("~", "$");
78101
- ret.append(traversal_1.Traversal.escapeNamespace(prefix), c, traversal);
78491
+ ret.append(traversal_1.Traversal.prefixVariable(traversal_1.Traversal.escapeNamespace(prefix)), c, traversal);
78102
78492
  }
78103
78493
  else if (c.get() instanceof core_1.Expressions.ClassName) {
78104
78494
  const name = traversal.lookupClassOrInterface(c.getFirstToken().getStr(), c.getFirstToken());
@@ -78961,10 +79351,10 @@ exports.Transpiler = Transpiler;
78961
79351
  "use strict";
78962
79352
 
78963
79353
  Object.defineProperty(exports, "__esModule", ({ value: true }));
78964
- exports.Keywords = exports.defaultKeywords = void 0;
79354
+ exports.Keywords = exports.DEFAULT_KEYWORDS = void 0;
78965
79355
  const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
78966
79356
  // https://www.w3schools.com/js/js_reserved.asp
78967
- exports.defaultKeywords = [
79357
+ exports.DEFAULT_KEYWORDS = [
78968
79358
  "abstract", "arguments", "await",
78969
79359
  "break", "byte", "catch",
78970
79360
  "char", "class", "const", "continue",
@@ -78992,10 +79382,13 @@ class Keywords {
78992
79382
  this.keywords = keywords;
78993
79383
  }
78994
79384
  else {
78995
- this.keywords = exports.defaultKeywords;
79385
+ this.keywords = exports.DEFAULT_KEYWORDS;
78996
79386
  }
78997
79387
  }
78998
79388
  handle(reg) {
79389
+ if (this.keywords.length === 0) {
79390
+ return;
79391
+ }
78999
79392
  reg.parse();
79000
79393
  for (const o of reg.getObjects()) {
79001
79394
  if (!(o instanceof abaplint.ABAPObject)) {
@@ -80676,6 +81069,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
80676
81069
  exports.DataTranspiler = void 0;
80677
81070
  const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
80678
81071
  const transpile_types_1 = __webpack_require__(/*! ../transpile_types */ "./node_modules/@abaplint/transpiler/build/src/transpile_types.js");
81072
+ const traversal_1 = __webpack_require__(/*! ../traversal */ "./node_modules/@abaplint/transpiler/build/src/traversal.js");
80679
81073
  const constant_1 = __webpack_require__(/*! ../expressions/constant */ "./node_modules/@abaplint/transpiler/build/src/expressions/constant.js");
80680
81074
  const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/@abaplint/transpiler/build/src/expressions/index.js");
80681
81075
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
@@ -80702,7 +81096,7 @@ class DataTranspiler {
80702
81096
  }
80703
81097
  const ret = new chunk_1.Chunk()
80704
81098
  .appendString("let ")
80705
- .append(found.getName().toLowerCase(), token, traversal)
81099
+ .append(traversal_1.Traversal.prefixVariable(traversal_1.Traversal.escapeNamespace(found.getName().toLowerCase())), token, traversal)
80706
81100
  .appendString(" = " + new transpile_types_1.TranspileTypes().toType(found.getType()))
80707
81101
  .append(";", node.getLastToken(), traversal)
80708
81102
  .append(value, node.getLastToken(), traversal);
@@ -81601,6 +81995,7 @@ exports.FormTranspiler = void 0;
81601
81995
  const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
81602
81996
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
81603
81997
  const unique_identifier_1 = __webpack_require__(/*! ../unique_identifier */ "./node_modules/@abaplint/transpiler/build/src/unique_identifier.js");
81998
+ const traversal_1 = __webpack_require__(/*! ../traversal */ "./node_modules/@abaplint/transpiler/build/src/traversal.js");
81604
81999
  class FormTranspiler {
81605
82000
  transpile(node, traversal) {
81606
82001
  unique_identifier_1.UniqueIdentifier.resetIndexBackup();
@@ -81610,13 +82005,13 @@ class FormTranspiler {
81610
82005
  const ret = new chunk_1.Chunk("async function " + name + "(INPUT) {");
81611
82006
  const params = [];
81612
82007
  for (const p of def?.getChangingParameters() || []) {
81613
- params.push(`let ${p.getName()} = INPUT.${p.getName()};`);
82008
+ params.push(`let ${traversal_1.Traversal.prefixVariable(p.getName())} = INPUT.${p.getName()};`);
81614
82009
  }
81615
82010
  for (const p of def?.getTablesParameters() || []) {
81616
- params.push(`let ${p.getName()} = INPUT.${p.getName()};`);
82011
+ params.push(`let ${traversal_1.Traversal.prefixVariable(p.getName())} = INPUT.${p.getName()};`);
81617
82012
  }
81618
82013
  for (const p of def?.getUsingParameters() || []) {
81619
- params.push(`let ${p.getName()} = INPUT.${p.getName()};`);
82014
+ params.push(`let ${traversal_1.Traversal.prefixVariable(p.getName())} = INPUT.${p.getName()};`);
81620
82015
  }
81621
82016
  if (params.length > 0) {
81622
82017
  ret.appendString("\n" + params.join("\n"));
@@ -82679,6 +83074,7 @@ class MethodImplementationTranspiler {
82679
83074
  for (const n in vars) {
82680
83075
  const identifier = vars[n];
82681
83076
  const varName = n.toLowerCase();
83077
+ const varPrefixed = traversal_1.Traversal.prefixVariable(varName);
82682
83078
  if (identifier.getMeta().includes("importing" /* abaplint.IdentifierMeta.MethodImporting */)
82683
83079
  || identifier.getMeta().includes("changing" /* abaplint.IdentifierMeta.MethodChanging */)
82684
83080
  || identifier.getMeta().includes("event_parameter" /* abaplint.IdentifierMeta.EventParameter */)
@@ -82691,31 +83087,31 @@ class MethodImplementationTranspiler {
82691
83087
  const passByValue = identifier.getMeta().includes("pass_by_value" /* abaplint.IdentifierMeta.PassByValue */);
82692
83088
  const type = identifier.getType();
82693
83089
  if (identifier.getMeta().includes("exporting" /* abaplint.IdentifierMeta.MethodExporting */)) {
82694
- after += `let ${varName} = ${unique}?.${varName} || ${new transpile_types_1.TranspileTypes().toType(identifier.getType())};\n`;
83090
+ after += `let ${varPrefixed} = ${unique}?.${varName} || ${new transpile_types_1.TranspileTypes().toType(identifier.getType())};\n`;
82695
83091
  }
82696
83092
  else if (identifier.getMeta().includes("importing" /* abaplint.IdentifierMeta.MethodImporting */)
82697
83093
  && parameterDefault === undefined
82698
83094
  && passByValue === false
82699
83095
  && isOptional === false
82700
83096
  && type.isGeneric() === false) {
82701
- after += `let ${varName} = ${unique}?.${varName};\n`;
83097
+ after += `let ${varPrefixed} = ${unique}?.${varName};\n`;
82702
83098
  if (identifier.getType().getQualifiedName() !== undefined && identifier.getType().getQualifiedName() !== "") {
82703
- after += `if (${varName}?.getQualifiedName === undefined || ${varName}.getQualifiedName() !== "${identifier.getType().getQualifiedName()?.toUpperCase()}") { ${varName} = undefined; }\n`;
83099
+ after += `if (${varPrefixed}?.getQualifiedName === undefined || ${varPrefixed}.getQualifiedName() !== "${identifier.getType().getQualifiedName()?.toUpperCase()}") { ${varPrefixed} = undefined; }\n`;
82704
83100
  }
82705
- after += `if (${varName} === undefined) { ${varName} = ${new transpile_types_1.TranspileTypes().toType(identifier.getType())}.set(${unique}.${varName}); }\n`;
83101
+ after += `if (${varPrefixed} === undefined) { ${varPrefixed} = ${new transpile_types_1.TranspileTypes().toType(identifier.getType())}.set(${unique}.${varName}); }\n`;
82706
83102
  }
82707
83103
  else if (identifier.getMeta().includes("importing" /* abaplint.IdentifierMeta.MethodImporting */)
82708
83104
  && type.isGeneric() === true) {
82709
83105
  if (isOptional === true) {
82710
- after += `let ${varName} = ${unique}?.${varName} || ${new transpile_types_1.TranspileTypes().toType(identifier.getType())};\n`;
83106
+ after += `let ${varPrefixed} = ${unique}?.${varName} || ${new transpile_types_1.TranspileTypes().toType(identifier.getType())};\n`;
82711
83107
  }
82712
83108
  else {
82713
- after += `let ${varName} = ${unique}?.${varName};\n`;
83109
+ after += `let ${varPrefixed} = ${unique}?.${varName};\n`;
82714
83110
  }
82715
83111
  if (type instanceof abaplint.BasicTypes.NumericGenericType) {
82716
- after += `if (${varName}.constructor.name === "Character") {
82717
- ${varName} = ${new transpile_types_1.TranspileTypes().toType(identifier.getType())};
82718
- ${varName}.set(${unique}?.${varName});
83112
+ after += `if (${varPrefixed}.constructor.name === "Character") {
83113
+ ${varPrefixed} = ${new transpile_types_1.TranspileTypes().toType(identifier.getType())};
83114
+ ${varPrefixed}.set(${unique}?.${varName});
82719
83115
  }\n`;
82720
83116
  }
82721
83117
  }
@@ -82723,19 +83119,19 @@ class MethodImplementationTranspiler {
82723
83119
  && type.isGeneric() === false) {
82724
83120
  after += new transpile_types_1.TranspileTypes().declare(identifier) + "\n";
82725
83121
  // note: it might be nessesary to do a type conversion, eg char is passed to xstring parameter
82726
- after += "if (" + unique + " && " + unique + "." + varName + ") {" + varName + ".set(" + unique + "." + varName + ");}\n";
83122
+ after += "if (" + unique + " && " + unique + "." + varName + ") {" + varPrefixed + ".set(" + unique + "." + varName + ");}\n";
82727
83123
  }
82728
83124
  else {
82729
83125
  after += new transpile_types_1.TranspileTypes().declare(identifier) + "\n";
82730
- after += "if (" + unique + " && " + unique + "." + varName + ") {" + varName + " = " + unique + "." + varName + ";}\n";
83126
+ after += "if (" + unique + " && " + unique + "." + varName + ") {" + varPrefixed + " = " + unique + "." + varName + ";}\n";
82731
83127
  }
82732
83128
  if (parameterDefault) {
82733
83129
  const val = this.buildDefault(parameterDefault, traversal, methodDef?.getFilename());
82734
83130
  if (passByValue === true || identifier.getMeta().includes("changing" /* abaplint.IdentifierMeta.MethodChanging */)) {
82735
- after += "if (" + unique + " === undefined || " + unique + "." + varName + " === undefined) {" + varName + ".set(" + val + ");}\n";
83131
+ after += "if (" + unique + " === undefined || " + unique + "." + varName + " === undefined) {" + varPrefixed + ".set(" + val + ");}\n";
82736
83132
  }
82737
83133
  else {
82738
- after += "if (" + unique + " === undefined || " + unique + "." + varName + " === undefined) {" + varName + " = " + val + ";}\n";
83134
+ after += "if (" + unique + " === undefined || " + unique + "." + varName + " === undefined) {" + varPrefixed + " = " + val + ";}\n";
82739
83135
  }
82740
83136
  }
82741
83137
  }
@@ -86356,6 +86752,7 @@ const StructureTranspilers = __webpack_require__(/*! ./structures */ "./node_mod
86356
86752
  const transpile_types_1 = __webpack_require__(/*! ./transpile_types */ "./node_modules/@abaplint/transpiler/build/src/transpile_types.js");
86357
86753
  const chunk_1 = __webpack_require__(/*! ./chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
86358
86754
  const expressions_1 = __webpack_require__(/*! ./expressions */ "./node_modules/@abaplint/transpiler/build/src/expressions/index.js");
86755
+ const keywords_1 = __webpack_require__(/*! ./keywords */ "./node_modules/@abaplint/transpiler/build/src/keywords.js");
86359
86756
  class Traversal {
86360
86757
  constructor(spaghetti, file, obj, reg, options) {
86361
86758
  this.scopeCache = undefined;
@@ -86368,6 +86765,13 @@ class Traversal {
86368
86765
  static escapeNamespace(name) {
86369
86766
  return name?.replace(/\//g, "$");
86370
86767
  }
86768
+ static prefixVariable(name) {
86769
+ // TODO: performace, make this a hash lookup?,
86770
+ if (keywords_1.DEFAULT_KEYWORDS.some(k => k === name)) {
86771
+ return "$" + name;
86772
+ }
86773
+ return name + "";
86774
+ }
86371
86775
  getCurrentObject() {
86372
86776
  return this.obj;
86373
86777
  }
@@ -87578,7 +87982,7 @@ class Validation {
87578
87982
  }
87579
87983
  exports.config.rules.forbidden_identifier.check = ["^unique\\d+$"];
87580
87984
  if (this.options?.keywords === undefined) {
87581
- for (const d of keywords_1.defaultKeywords) {
87985
+ for (const d of keywords_1.DEFAULT_KEYWORDS) {
87582
87986
  const add = "^" + d + "$";
87583
87987
  exports.config.rules["forbidden_identifier"]["check"].push(add);
87584
87988
  }
@@ -87932,6 +88336,35 @@ module.exports = {
87932
88336
 
87933
88337
  /***/ }),
87934
88338
 
88339
+ /***/ "./node_modules/fast-xml-parser/src/ignoreAttributes.js":
88340
+ /*!**************************************************************!*\
88341
+ !*** ./node_modules/fast-xml-parser/src/ignoreAttributes.js ***!
88342
+ \**************************************************************/
88343
+ /***/ ((module) => {
88344
+
88345
+ function getIgnoreAttributesFn(ignoreAttributes) {
88346
+ if (typeof ignoreAttributes === 'function') {
88347
+ return ignoreAttributes
88348
+ }
88349
+ if (Array.isArray(ignoreAttributes)) {
88350
+ return (attrName) => {
88351
+ for (const pattern of ignoreAttributes) {
88352
+ if (typeof pattern === 'string' && attrName === pattern) {
88353
+ return true
88354
+ }
88355
+ if (pattern instanceof RegExp && pattern.test(attrName)) {
88356
+ return true
88357
+ }
88358
+ }
88359
+ }
88360
+ }
88361
+ return () => false
88362
+ }
88363
+
88364
+ module.exports = getIgnoreAttributesFn
88365
+
88366
+ /***/ }),
88367
+
87935
88368
  /***/ "./node_modules/fast-xml-parser/src/util.js":
87936
88369
  /*!**************************************************!*\
87937
88370
  !*** ./node_modules/fast-xml-parser/src/util.js ***!
@@ -88461,6 +88894,7 @@ function getPositionFromMatch(match) {
88461
88894
 
88462
88895
  //parse Empty Node as self closing node
88463
88896
  const buildFromOrderedJs = __webpack_require__(/*! ./orderedJs2Xml */ "./node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js");
88897
+ const getIgnoreAttributesFn = __webpack_require__(/*! ../ignoreAttributes */ "./node_modules/fast-xml-parser/src/ignoreAttributes.js")
88464
88898
 
88465
88899
  const defaultOptions = {
88466
88900
  attributeNamePrefix: '@_',
@@ -88498,11 +88932,12 @@ const defaultOptions = {
88498
88932
 
88499
88933
  function Builder(options) {
88500
88934
  this.options = Object.assign({}, defaultOptions, options);
88501
- if (this.options.ignoreAttributes || this.options.attributesGroupName) {
88935
+ if (this.options.ignoreAttributes === true || this.options.attributesGroupName) {
88502
88936
  this.isAttribute = function(/*a*/) {
88503
88937
  return false;
88504
88938
  };
88505
88939
  } else {
88940
+ this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes)
88506
88941
  this.attrPrefixLen = this.options.attributeNamePrefix.length;
88507
88942
  this.isAttribute = isAttribute;
88508
88943
  }
@@ -88531,13 +88966,14 @@ Builder.prototype.build = function(jObj) {
88531
88966
  [this.options.arrayNodeName] : jObj
88532
88967
  }
88533
88968
  }
88534
- return this.j2x(jObj, 0).val;
88969
+ return this.j2x(jObj, 0, []).val;
88535
88970
  }
88536
88971
  };
88537
88972
 
88538
- Builder.prototype.j2x = function(jObj, level) {
88973
+ Builder.prototype.j2x = function(jObj, level, ajPath) {
88539
88974
  let attrStr = '';
88540
88975
  let val = '';
88976
+ const jPath = ajPath.join('.')
88541
88977
  for (let key in jObj) {
88542
88978
  if(!Object.prototype.hasOwnProperty.call(jObj, key)) continue;
88543
88979
  if (typeof jObj[key] === 'undefined') {
@@ -88560,9 +88996,9 @@ Builder.prototype.j2x = function(jObj, level) {
88560
88996
  } else if (typeof jObj[key] !== 'object') {
88561
88997
  //premitive type
88562
88998
  const attr = this.isAttribute(key);
88563
- if (attr) {
88999
+ if (attr && !this.ignoreAttributesFn(attr, jPath)) {
88564
89000
  attrStr += this.buildAttrPairStr(attr, '' + jObj[key]);
88565
- }else {
89001
+ } else if (!attr) {
88566
89002
  //tag value
88567
89003
  if (key === this.options.textNodeName) {
88568
89004
  let newval = this.options.tagValueProcessor(key, '' + jObj[key]);
@@ -88586,13 +89022,13 @@ Builder.prototype.j2x = function(jObj, level) {
88586
89022
  // val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
88587
89023
  } else if (typeof item === 'object') {
88588
89024
  if(this.options.oneListGroup){
88589
- const result = this.j2x(item, level + 1);
89025
+ const result = this.j2x(item, level + 1, ajPath.concat(key));
88590
89026
  listTagVal += result.val;
88591
89027
  if (this.options.attributesGroupName && item.hasOwnProperty(this.options.attributesGroupName)) {
88592
89028
  listTagAttr += result.attrStr
88593
89029
  }
88594
89030
  }else{
88595
- listTagVal += this.processTextOrObjNode(item, key, level)
89031
+ listTagVal += this.processTextOrObjNode(item, key, level, ajPath)
88596
89032
  }
88597
89033
  } else {
88598
89034
  if (this.options.oneListGroup) {
@@ -88617,7 +89053,7 @@ Builder.prototype.j2x = function(jObj, level) {
88617
89053
  attrStr += this.buildAttrPairStr(Ks[j], '' + jObj[key][Ks[j]]);
88618
89054
  }
88619
89055
  } else {
88620
- val += this.processTextOrObjNode(jObj[key], key, level)
89056
+ val += this.processTextOrObjNode(jObj[key], key, level, ajPath)
88621
89057
  }
88622
89058
  }
88623
89059
  }
@@ -88632,8 +89068,8 @@ Builder.prototype.buildAttrPairStr = function(attrName, val){
88632
89068
  } else return ' ' + attrName + '="' + val + '"';
88633
89069
  }
88634
89070
 
88635
- function processTextOrObjNode (object, key, level) {
88636
- const result = this.j2x(object, level + 1);
89071
+ function processTextOrObjNode (object, key, level, ajPath) {
89072
+ const result = this.j2x(object, level + 1, ajPath.concat(key));
88637
89073
  if (object[this.options.textNodeName] !== undefined && Object.keys(object).length === 1) {
88638
89074
  return this.buildTextValNode(object[this.options.textNodeName], key, result.attrStr, level);
88639
89075
  } else {
@@ -89121,6 +89557,7 @@ const util = __webpack_require__(/*! ../util */ "./node_modules/fast-xml-parser/
89121
89557
  const xmlNode = __webpack_require__(/*! ./xmlNode */ "./node_modules/fast-xml-parser/src/xmlparser/xmlNode.js");
89122
89558
  const readDocType = __webpack_require__(/*! ./DocTypeReader */ "./node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js");
89123
89559
  const toNumber = __webpack_require__(/*! strnum */ "./node_modules/strnum/strnum.js");
89560
+ const getIgnoreAttributesFn = __webpack_require__(/*! ../ignoreAttributes */ "./node_modules/fast-xml-parser/src/ignoreAttributes.js")
89124
89561
 
89125
89562
  // const regx =
89126
89563
  // '<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)'
@@ -89169,6 +89606,7 @@ class OrderedObjParser{
89169
89606
  this.readStopNodeData = readStopNodeData;
89170
89607
  this.saveTextToParentTag = saveTextToParentTag;
89171
89608
  this.addChild = addChild;
89609
+ this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes)
89172
89610
  }
89173
89611
 
89174
89612
  }
@@ -89241,7 +89679,7 @@ function resolveNameSpace(tagname) {
89241
89679
  const attrsRegx = new RegExp('([^\\s=]+)\\s*(=\\s*([\'"])([\\s\\S]*?)\\3)?', 'gm');
89242
89680
 
89243
89681
  function buildAttributesMap(attrStr, jPath, tagName) {
89244
- if (!this.options.ignoreAttributes && typeof attrStr === 'string') {
89682
+ if (this.options.ignoreAttributes !== true && typeof attrStr === 'string') {
89245
89683
  // attrStr = attrStr.replace(/\r?\n/g, ' ');
89246
89684
  //attrStr = attrStr || attrStr.trim();
89247
89685
 
@@ -89250,6 +89688,9 @@ function buildAttributesMap(attrStr, jPath, tagName) {
89250
89688
  const attrs = {};
89251
89689
  for (let i = 0; i < len; i++) {
89252
89690
  const attrName = this.resolveNameSpace(matches[i][1]);
89691
+ if (this.ignoreAttributesFn(attrName, jPath)) {
89692
+ continue
89693
+ }
89253
89694
  let oldVal = matches[i][4];
89254
89695
  let aName = this.options.attributeNamePrefix + attrName;
89255
89696
  if (attrName.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.10.10",
3
+ "version": "2.10.12",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -26,12 +26,12 @@
26
26
  "author": "abaplint",
27
27
  "license": "MIT",
28
28
  "devDependencies": {
29
- "@abaplint/transpiler": "^2.10.10",
29
+ "@abaplint/transpiler": "^2.10.12",
30
30
  "@types/glob": "^8.1.0",
31
31
  "glob": "=7.2.0",
32
32
  "@types/progress": "^2.0.7",
33
- "@types/node": "^22.5.1",
34
- "@abaplint/core": "^2.112.22",
33
+ "@types/node": "^22.5.4",
34
+ "@abaplint/core": "^2.113.6",
35
35
  "progress": "^2.0.3",
36
36
  "webpack": "^5.94.0",
37
37
  "webpack-cli": "^5.1.4",