@abaplint/transpiler-cli 2.7.165 → 2.8.0

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 +243 -303
  2. package/package.json +2 -2
package/build/bundle.js CHANGED
@@ -79,9 +79,8 @@ class FileOperations {
79
79
  fs.rmSync(p, { recursive: true });
80
80
  }
81
81
  static loadFiles(config) {
82
- var _a;
83
82
  const files = [];
84
- const filter = ((_a = config.input_filter) !== null && _a !== void 0 ? _a : []).map(pattern => new RegExp(pattern, "i"));
83
+ const filter = (config.input_filter ?? []).map(pattern => new RegExp(pattern, "i"));
85
84
  let skipped = 0;
86
85
  let added = 0;
87
86
  for (const filename of glob.sync(config.input_folder + "/**", { nosort: true, nodir: true })) {
@@ -72746,7 +72745,7 @@ class DatabaseSetup {
72746
72745
  }
72747
72746
  else if (obj instanceof abaplint.Objects.Class
72748
72747
  || obj instanceof abaplint.Objects.Interface) {
72749
- if ((options === null || options === void 0 ? void 0 : options.skipReposrc) !== true) {
72748
+ if (options?.skipReposrc !== true) {
72750
72749
  insert.push(this.insertREPOSRC(obj));
72751
72750
  }
72752
72751
  }
@@ -72755,12 +72754,11 @@ class DatabaseSetup {
72755
72754
  return insert;
72756
72755
  }
72757
72756
  insertREPOSRC(obj) {
72758
- var _a;
72759
72757
  if (this.reg.getObject("TABL", "REPOSRC") === undefined) {
72760
72758
  return "";
72761
72759
  }
72762
72760
  const name = obj.getName().toUpperCase();
72763
- const raw = (_a = obj.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getRaw();
72761
+ const raw = obj.getMainABAPFile()?.getRaw();
72764
72762
  if (raw === undefined) {
72765
72763
  return "";
72766
72764
  }
@@ -72824,7 +72822,7 @@ class PGDatabaseSchema {
72824
72822
  buildVIEW(view) {
72825
72823
  const fields = view.getFields();
72826
72824
  let firstTabname = "";
72827
- const columns = fields === null || fields === void 0 ? void 0 : fields.map((f) => {
72825
+ const columns = fields?.map((f) => {
72828
72826
  firstTabname = "'" + f.TABNAME.toLowerCase() + "'";
72829
72827
  return firstTabname + "." + f.FIELDNAME.toLowerCase() + " AS " + f.VIEWFIELD.toLowerCase();
72830
72828
  }).join(", ");
@@ -72935,7 +72933,7 @@ class SnowflakeDatabaseSchema {
72935
72933
  buildVIEW(view) {
72936
72934
  const fields = view.getFields();
72937
72935
  let firstTabname = "";
72938
- const columns = fields === null || fields === void 0 ? void 0 : fields.map((f) => {
72936
+ const columns = fields?.map((f) => {
72939
72937
  firstTabname = "'" + f.TABNAME.toLowerCase() + "'";
72940
72938
  return firstTabname + "." + f.FIELDNAME.toLowerCase() + " AS " + f.VIEWFIELD.toLowerCase();
72941
72939
  }).join(", ");
@@ -73048,7 +73046,7 @@ class SQLiteDatabaseSchema {
73048
73046
  buildVIEW(view) {
73049
73047
  const fields = view.getFields();
73050
73048
  let firstTabname = "";
73051
- const columns = fields === null || fields === void 0 ? void 0 : fields.map((f) => {
73049
+ const columns = fields?.map((f) => {
73052
73050
  firstTabname = "'" + f.TABNAME.toLowerCase() + "'";
73053
73051
  return firstTabname + "." + f.FIELDNAME.toLowerCase() + " AS " + f.VIEWFIELD.toLowerCase();
73054
73052
  }).join(", ");
@@ -73293,8 +73291,7 @@ const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abap
73293
73291
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
73294
73292
  class CallTransformationParametersTranspiler {
73295
73293
  transpile(node, traversal) {
73296
- var _a;
73297
- if (((_a = node.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof abaplint.Expressions.Dynamic) {
73294
+ if (node.getFirstChild()?.get() instanceof abaplint.Expressions.Dynamic) {
73298
73295
  return new chunk_1.Chunk().append(node.concatTokens(), node, traversal);
73299
73296
  }
73300
73297
  else {
@@ -73341,7 +73338,6 @@ const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/tr
73341
73338
  class CompareTranspiler {
73342
73339
  transpile(node, traversal) {
73343
73340
  // todo, this is not correct
73344
- var _a, _b;
73345
73341
  const concat = node.concatTokens().toUpperCase();
73346
73342
  let pre = concat.startsWith("NOT ") ? "!" : "";
73347
73343
  const sources = node.findDirectExpressions(core_1.Expressions.Source).concat(node.findDirectExpressions(core_1.Expressions.SourceFieldSymbol));
@@ -73387,11 +73383,11 @@ class CompareTranspiler {
73387
73383
  return new chunk_1.Chunk().appendString(pre + "INPUT && INPUT." + field + " === undefined && INPUT.importing?." + field + " === undefined");
73388
73384
  }
73389
73385
  if (concat.startsWith("NOT ") || concat.includes(" IS NOT INSTANCE OF ")) {
73390
- const cname = (_a = node.findDirectExpression(core_1.Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.concatTokens();
73386
+ const cname = node.findDirectExpression(core_1.Expressions.ClassName)?.concatTokens();
73391
73387
  return new chunk_1.Chunk().appendString("abap.compare.instance_of(").appendChunk(s0).appendString(`, ${cname}) === false`);
73392
73388
  }
73393
73389
  else if (concat.includes(" IS INSTANCE OF ")) {
73394
- const cname = (_b = node.findDirectExpression(core_1.Expressions.ClassName)) === null || _b === void 0 ? void 0 : _b.concatTokens();
73390
+ const cname = node.findDirectExpression(core_1.Expressions.ClassName)?.concatTokens();
73395
73391
  return new chunk_1.Chunk().appendString("abap.compare.instance_of(").appendChunk(s0).appendString(`, ${cname})`);
73396
73392
  }
73397
73393
  }
@@ -73619,11 +73615,11 @@ class ComponentCompareTranspiler {
73619
73615
  else if (concat.endsWith("IS INITIAL")) {
73620
73616
  return new chunk_1.Chunk(`(I) => {return abap.compare.initial(${component});}`);
73621
73617
  }
73622
- if (concat.startsWith((componentExpression === null || componentExpression === void 0 ? void 0 : componentExpression.concatTokens().toUpperCase()) + " IN ")) {
73618
+ if (concat.startsWith(componentExpression?.concatTokens().toUpperCase() + " IN ")) {
73623
73619
  const source = traversal.traverse(node.findDirectExpression(core_1.Expressions.Source)).getCode();
73624
73620
  return new chunk_1.Chunk(`(I) => {return ${pre}abap.compare.in(${component}, ${source});}`);
73625
73621
  }
73626
- else if (concat.startsWith((componentExpression === null || componentExpression === void 0 ? void 0 : componentExpression.concatTokens().toUpperCase()) + " NOT IN ")) {
73622
+ else if (concat.startsWith(componentExpression?.concatTokens().toUpperCase() + " NOT IN ")) {
73627
73623
  const source = traversal.traverse(node.findDirectExpression(core_1.Expressions.Source)).getCode();
73628
73624
  return new chunk_1.Chunk(`(I) => {return !abap.compare.in(${component}, ${source});}`);
73629
73625
  }
@@ -73836,7 +73832,12 @@ class ConstantTranspiler {
73836
73832
  const concat = int.concatTokens().trim();
73837
73833
  const parsed = Number.parseInt(concat, 10);
73838
73834
  let code = "";
73839
- if (parsed > 2147483647 || parsed < -2147483648) {
73835
+ if (concat.length > 18) {
73836
+ // its potentially larger than Number.MAX_SAFE_INTEGER
73837
+ // https://stackoverflow.com/questions/1379934/large-numbers-erroneously-rounded-in-javascript
73838
+ code = `new abap.types.Integer8().set("${concat}")`;
73839
+ }
73840
+ else if (parsed > 2147483647 || parsed < -2147483648) {
73840
73841
  code = `new abap.types.Integer8().set(${concat})`;
73841
73842
  }
73842
73843
  else if (parsed >= -10 && parsed <= 200) {
@@ -74396,8 +74397,7 @@ const method_call_param_1 = __webpack_require__(/*! ./method_call_param */ "./no
74396
74397
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
74397
74398
  class MethodCallTranspiler {
74398
74399
  transpile(node, traversal) {
74399
- var _a;
74400
- const nameToken = (_a = node.findDirectExpression(core_1.Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
74400
+ const nameToken = node.findDirectExpression(core_1.Expressions.MethodName)?.getFirstToken();
74401
74401
  if (nameToken === undefined) {
74402
74402
  throw new Error("MethodCallTranspiler, name not found");
74403
74403
  }
@@ -74409,7 +74409,7 @@ class MethodCallTranspiler {
74409
74409
  name = name + "(";
74410
74410
  }
74411
74411
  const m = traversal.findMethodReference(nameToken, traversal.findCurrentScopeByToken(nameToken));
74412
- if ((m === null || m === void 0 ? void 0 : m.name) && traversal.isBuiltinMethod(nameToken) === false) {
74412
+ if (m?.name && traversal.isBuiltinMethod(nameToken) === false) {
74413
74413
  name = m.name.toLowerCase() + "(";
74414
74414
  }
74415
74415
  const step = node.findDirectExpression(core_1.Expressions.MethodCallParam);
@@ -74418,7 +74418,7 @@ class MethodCallTranspiler {
74418
74418
  }
74419
74419
  const ret = new chunk_1.Chunk();
74420
74420
  ret.append(traversal_1.Traversal.escapeNamespace(name.replace("~", "$")), nameToken, traversal);
74421
- ret.appendChunk(new method_call_param_1.MethodCallParamTranspiler(m === null || m === void 0 ? void 0 : m.def).transpile(step, traversal));
74421
+ ret.appendChunk(new method_call_param_1.MethodCallParamTranspiler(m?.def).transpile(step, traversal));
74422
74422
  ret.appendString(")");
74423
74423
  return ret;
74424
74424
  }
@@ -74572,14 +74572,13 @@ class MethodCallParamTranspiler {
74572
74572
  this.m = m;
74573
74573
  }
74574
74574
  transpile(node, traversal) {
74575
- var _a, _b;
74576
74575
  let name = "";
74577
74576
  if (!(node.get() instanceof core_1.Expressions.MethodCallParam)) {
74578
- throw new Error("MethodCallParam, unexpected node, " + (node === null || node === void 0 ? void 0 : node.get().constructor.name));
74577
+ throw new Error("MethodCallParam, unexpected node, " + node?.get().constructor.name);
74579
74578
  }
74580
74579
  const source = node.findDirectExpression(core_1.Expressions.Source);
74581
74580
  if (source) {
74582
- const def = (_b = (_a = this.m) === null || _a === void 0 ? void 0 : _a.getParameters().getDefaultImporting()) === null || _b === void 0 ? void 0 : _b.toLowerCase();
74581
+ const def = this.m?.getParameters().getDefaultImporting()?.toLowerCase();
74583
74582
  if (this.m === undefined || def === undefined) {
74584
74583
  return traversal.traverse(source);
74585
74584
  }
@@ -74689,7 +74688,7 @@ class MethodSourceTranspiler {
74689
74688
  if (child.get() instanceof core_1.Expressions.ClassName) {
74690
74689
  call += traversal.lookupClassOrInterface(child.concatTokens(), child.getFirstToken());
74691
74690
  }
74692
- else if (child.get() instanceof core_1.Expressions.Dynamic && (nextChild === null || nextChild === void 0 ? void 0 : nextChild.concatTokens()) === "=>") {
74691
+ else if (child.get() instanceof core_1.Expressions.Dynamic && nextChild?.concatTokens() === "=>") {
74693
74692
  const second = child.getChildren()[1];
74694
74693
  const illegalClass = traversal.lookupClassOrInterface("'CX_SY_DYN_CALL_ILLEGAL_CLASS'", child.getFirstToken(), true);
74695
74694
  const illegalMethod = traversal.lookupClassOrInterface("'CX_SY_DYN_CALL_ILLEGAL_METHOD'", child.getFirstToken(), true);
@@ -74885,9 +74884,8 @@ const core_1 = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abapli
74885
74884
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
74886
74885
  class ParameterSTranspiler {
74887
74886
  transpile(node, traversal) {
74888
- var _a;
74889
- const nameToken = (_a = node.findDirectExpression(core_1.Expressions.ParameterName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
74890
- const name = nameToken === null || nameToken === void 0 ? void 0 : nameToken.getStr().toLowerCase();
74887
+ const nameToken = node.findDirectExpression(core_1.Expressions.ParameterName)?.getFirstToken();
74888
+ const name = nameToken?.getStr().toLowerCase();
74891
74889
  const source = traversal.traverse(node.findDirectExpression(core_1.Expressions.Source));
74892
74890
  return new chunk_1.Chunk().append(name + ": ", nameToken || node, traversal).appendChunk(source);
74893
74891
  }
@@ -74911,9 +74909,8 @@ const core_1 = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abapli
74911
74909
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
74912
74910
  class ParameterTTranspiler {
74913
74911
  transpile(node, traversal) {
74914
- var _a;
74915
- const nameToken = (_a = node.findDirectExpression(core_1.Expressions.ParameterName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
74916
- const name = nameToken === null || nameToken === void 0 ? void 0 : nameToken.getStr();
74912
+ const nameToken = node.findDirectExpression(core_1.Expressions.ParameterName)?.getFirstToken();
74913
+ const name = nameToken?.getStr();
74917
74914
  const source = traversal.traverse(node.findDirectExpression(core_1.Expressions.Target));
74918
74915
  return new chunk_1.Chunk().append(name + ": ", nameToken || node, traversal).appendChunk(source);
74919
74916
  }
@@ -75228,7 +75225,6 @@ const transpile_types_1 = __webpack_require__(/*! ../transpile_types */ "./node_
75228
75225
  const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/transpiler/build/src/expressions/source.js");
75229
75226
  class SQLCondTranspiler {
75230
75227
  transpile(node, traversal, table) {
75231
- var _a;
75232
75228
  let ret = "";
75233
75229
  for (const c of node.getChildren()) {
75234
75230
  if (c instanceof abaplint.Nodes.ExpressionNode
@@ -75237,7 +75233,7 @@ class SQLCondTranspiler {
75237
75233
  ret += " ";
75238
75234
  }
75239
75235
  if (c.findDirectExpression(abaplint.Expressions.Dynamic)) {
75240
- const chain = (_a = c.findDirectExpression(abaplint.Expressions.Dynamic)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(abaplint.Expressions.FieldChain);
75236
+ const chain = c.findDirectExpression(abaplint.Expressions.Dynamic)?.findFirstExpression(abaplint.Expressions.FieldChain);
75241
75237
  if (chain) {
75242
75238
  const code = new field_chain_1.FieldChainTranspiler(true).transpile(chain, traversal).getCode();
75243
75239
  ret += `" + abap.expandDynamic(${code}, (name) => {try { return eval(name);} catch {}}) + "`;
@@ -75348,7 +75344,7 @@ class SQLCondTranspiler {
75348
75344
  const concat = source.concatTokens();
75349
75345
  const conversionField = traversal.isSQLConversion(source.getFirstToken());
75350
75346
  if (conversionField) {
75351
- const field = (table === null || table === void 0 ? void 0 : table.parseType(traversal.reg)).getComponentByName(conversionField);
75347
+ const field = (table?.parseType(traversal.reg)).getComponentByName(conversionField);
75352
75348
  ret += "'\" + " + new transpile_types_1.TranspileTypes().toType(field) + ".set(" + concat + ").get() + \"'";
75353
75349
  }
75354
75350
  else if (concat.startsWith("`")) {
@@ -75749,7 +75745,7 @@ const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/tr
75749
75745
  class SQLSourceTranspiler {
75750
75746
  transpile(node, traversal) {
75751
75747
  let s = node.findDirectExpression(abaplint.Expressions.Source);
75752
- if ((s === null || s === void 0 ? void 0 : s.getChildren().length) === 1 && s.getChildren()[0].get() instanceof abaplint.Expressions.SQLAliasField) {
75748
+ if (s?.getChildren().length === 1 && s.getChildren()[0].get() instanceof abaplint.Expressions.SQLAliasField) {
75753
75749
  const chunk = new chunk_1.Chunk();
75754
75750
  let concat = s.concatTokens();
75755
75751
  if (concat.includes("~") && concat.split("~")[0].includes("/")) {
@@ -76039,7 +76035,6 @@ class HandleABAP {
76039
76035
  this.options = options;
76040
76036
  }
76041
76037
  runObject(obj, reg) {
76042
- var _a, _b, _c;
76043
76038
  let ret = [];
76044
76039
  if (obj instanceof abaplint.Objects.Program && obj.isInclude() === true) {
76045
76040
  // includes are only compiled along with the programs where its used?
@@ -76048,14 +76043,14 @@ class HandleABAP {
76048
76043
  const spaghetti = new abaplint.SyntaxLogic(reg, obj).run().spaghetti;
76049
76044
  for (const file of obj.getSequencedFiles()) {
76050
76045
  const chunk = new chunk_1.Chunk();
76051
- if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.addFilenames) === true) {
76046
+ if (this.options?.addFilenames === true) {
76052
76047
  chunk.appendString("// " + file.getFilename() + "\n");
76053
76048
  }
76054
76049
  const rearranged = new rearranger_1.Rearranger().run(obj.getType(), file.getStructure());
76055
76050
  const contents = new traversal_1.Traversal(spaghetti, file, obj, reg, this.options).traverse(rearranged);
76056
76051
  chunk.appendChunk(contents);
76057
76052
  chunk.stripLastNewline();
76058
- chunk.runIndentationLogic((_b = this.options) === null || _b === void 0 ? void 0 : _b.ignoreSourceMap);
76053
+ chunk.runIndentationLogic(this.options?.ignoreSourceMap);
76059
76054
  const exports = this.findExports(file.getStructure());
76060
76055
  const filename = file.getFilename().replace(".abap", ".mjs").toLowerCase();
76061
76056
  const output = {
@@ -76071,7 +76066,7 @@ class HandleABAP {
76071
76066
  ret.push(output);
76072
76067
  }
76073
76068
  ret = this.rearrangeClassLocals(obj, ret);
76074
- if (((_c = this.options) === null || _c === void 0 ? void 0 : _c.addCommonJS) === true) {
76069
+ if (this.options?.addCommonJS === true) {
76075
76070
  ret.map(output => output.chunk = this.addImportsAndExports(output));
76076
76071
  }
76077
76072
  return ret;
@@ -76127,10 +76122,9 @@ class HandleABAP {
76127
76122
  return ret;
76128
76123
  }
76129
76124
  addImportsAndExports(output) {
76130
- var _a;
76131
76125
  const contents = new chunk_1.Chunk();
76132
76126
  for (const r of output.requires) {
76133
- const name = (_a = r.name) === null || _a === void 0 ? void 0 : _a.toLowerCase();
76127
+ const name = r.name?.toLowerCase();
76134
76128
  const filename = r.filename.replace(".abap", ".mjs");
76135
76129
  if (filename === output.filename) {
76136
76130
  continue;
@@ -76149,19 +76143,18 @@ class HandleABAP {
76149
76143
  return contents;
76150
76144
  }
76151
76145
  findExports(node) {
76152
- var _a, _b;
76153
76146
  if (node === undefined) {
76154
76147
  return [];
76155
76148
  }
76156
76149
  const res = [];
76157
76150
  for (const c of node.findAllStatements(abaplint.Statements.ClassDefinition)) {
76158
- const e = (_a = c.findFirstExpression(abaplint.Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr();
76151
+ const e = c.findFirstExpression(abaplint.Expressions.ClassName)?.getFirstToken().getStr();
76159
76152
  if (e) {
76160
76153
  res.push(e.toLowerCase());
76161
76154
  }
76162
76155
  }
76163
76156
  for (const c of node.findAllStatements(abaplint.Statements.Interface)) {
76164
- const e = (_b = c.findFirstExpression(abaplint.Expressions.InterfaceName)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr();
76157
+ const e = c.findFirstExpression(abaplint.Expressions.InterfaceName)?.getFirstToken().getStr();
76165
76158
  if (e) {
76166
76159
  res.push(e.toLowerCase());
76167
76160
  }
@@ -76188,8 +76181,7 @@ const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/tr
76188
76181
  const transpile_types_1 = __webpack_require__(/*! ../transpile_types */ "./node_modules/@abaplint/transpiler/build/src/transpile_types.js");
76189
76182
  class HandleDataElement {
76190
76183
  runObject(obj, reg) {
76191
- var _a;
76192
- const filename = (_a = obj.getXMLFile()) === null || _a === void 0 ? void 0 : _a.getFilename().replace(".xml", ".mjs").toLowerCase();
76184
+ const filename = obj.getXMLFile()?.getFilename().replace(".xml", ".mjs").toLowerCase();
76193
76185
  if (filename === undefined) {
76194
76186
  return [];
76195
76187
  }
@@ -76239,8 +76231,7 @@ const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/tr
76239
76231
  // view, much like the tables
76240
76232
  class HandleEnqu {
76241
76233
  runObject(obj, _reg) {
76242
- var _a;
76243
- const filename = (_a = obj.getXMLFile()) === null || _a === void 0 ? void 0 : _a.getFilename().replace(".xml", ".mjs").toLowerCase();
76234
+ const filename = obj.getXMLFile()?.getFilename().replace(".xml", ".mjs").toLowerCase();
76244
76235
  if (filename === undefined) {
76245
76236
  return [];
76246
76237
  }
@@ -76290,8 +76281,7 @@ exports.HandleMSAG = void 0;
76290
76281
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
76291
76282
  class HandleMSAG {
76292
76283
  runObject(obj, _reg) {
76293
- var _a;
76294
- const filename = (_a = obj.getXMLFile()) === null || _a === void 0 ? void 0 : _a.getFilename().replace(".xml", ".mjs").toLowerCase();
76284
+ const filename = obj.getXMLFile()?.getFilename().replace(".xml", ".mjs").toLowerCase();
76295
76285
  if (filename === undefined) {
76296
76286
  return [];
76297
76287
  }
@@ -76331,8 +76321,7 @@ exports.HandleOA2P = void 0;
76331
76321
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
76332
76322
  class HandleOA2P {
76333
76323
  runObject(obj, _reg) {
76334
- var _a;
76335
- const filename = (_a = obj.getXMLFile()) === null || _a === void 0 ? void 0 : _a.getFilename().replace(".xml", ".mjs").toLowerCase();
76324
+ const filename = obj.getXMLFile()?.getFilename().replace(".xml", ".mjs").toLowerCase();
76336
76325
  if (filename === undefined) {
76337
76326
  return [];
76338
76327
  }
@@ -76370,8 +76359,7 @@ exports.HandleSMIM = void 0;
76370
76359
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
76371
76360
  class HandleSMIM {
76372
76361
  runObject(obj, _reg) {
76373
- var _a;
76374
- const filename = (_a = obj.getXMLFile()) === null || _a === void 0 ? void 0 : _a.getFilename().replace(".xml", ".mjs").toLowerCase();
76362
+ const filename = obj.getXMLFile()?.getFilename().replace(".xml", ".mjs").toLowerCase();
76375
76363
  if (filename === undefined) {
76376
76364
  return [];
76377
76365
  }
@@ -76379,7 +76367,7 @@ class HandleSMIM {
76379
76367
  const dataFile = obj.getDataFile();
76380
76368
  const chunk = new chunk_1.Chunk().appendString(`abap.SMIM["${obj.getName().toUpperCase()}"] = {
76381
76369
  "objectType": "SMIM",
76382
- "filename": ${JSON.stringify(dataFile === null || dataFile === void 0 ? void 0 : dataFile.getFilename())},
76370
+ "filename": ${JSON.stringify(dataFile?.getFilename())},
76383
76371
  "url": ${JSON.stringify(obj.getURL())},
76384
76372
  "class": ${JSON.stringify(obj.getClass())},
76385
76373
  };`);
@@ -76400,8 +76388,8 @@ class HandleSMIM {
76400
76388
  name: obj.getName(),
76401
76389
  type: obj.getType(),
76402
76390
  },
76403
- filename: dataFile === null || dataFile === void 0 ? void 0 : dataFile.getFilename(),
76404
- chunk: new chunk_1.Chunk().appendString(dataFile === null || dataFile === void 0 ? void 0 : dataFile.getRaw()),
76391
+ filename: dataFile?.getFilename(),
76392
+ chunk: new chunk_1.Chunk().appendString(dataFile?.getRaw()),
76405
76393
  requires: [],
76406
76394
  exports: [],
76407
76395
  };
@@ -76430,8 +76418,7 @@ const transpile_types_1 = __webpack_require__(/*! ../transpile_types */ "./node_
76430
76418
  // tables or structures
76431
76419
  class HandleTable {
76432
76420
  runObject(obj, reg) {
76433
- var _a;
76434
- const filename = (_a = obj.getXMLFile()) === null || _a === void 0 ? void 0 : _a.getFilename().replace(".xml", ".mjs").toLowerCase();
76421
+ const filename = obj.getXMLFile()?.getFilename().replace(".xml", ".mjs").toLowerCase();
76435
76422
  if (filename === undefined) {
76436
76423
  return [];
76437
76424
  }
@@ -76473,8 +76460,7 @@ const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/tr
76473
76460
  const transpile_types_1 = __webpack_require__(/*! ../transpile_types */ "./node_modules/@abaplint/transpiler/build/src/transpile_types.js");
76474
76461
  class HandleTableType {
76475
76462
  runObject(obj, reg) {
76476
- var _a;
76477
- const filename = (_a = obj.getXMLFile()) === null || _a === void 0 ? void 0 : _a.getFilename().replace(".xml", ".mjs").toLowerCase();
76463
+ const filename = obj.getXMLFile()?.getFilename().replace(".xml", ".mjs").toLowerCase();
76478
76464
  if (filename === undefined) {
76479
76465
  return [];
76480
76466
  }
@@ -76517,17 +76503,16 @@ const transpile_types_1 = __webpack_require__(/*! ../transpile_types */ "./node_
76517
76503
  const traversal_1 = __webpack_require__(/*! ../traversal */ "./node_modules/@abaplint/transpiler/build/src/traversal.js");
76518
76504
  class HandleTypePool {
76519
76505
  runObject(obj, reg) {
76520
- var _a;
76521
- const spaghetti = (_a = new abaplint.SyntaxLogic(reg, obj).run().spaghetti.getFirstChild()) === null || _a === void 0 ? void 0 : _a.getFirstChild();
76506
+ const spaghetti = new abaplint.SyntaxLogic(reg, obj).run().spaghetti.getFirstChild()?.getFirstChild();
76522
76507
  const chunk = new chunk_1.Chunk();
76523
76508
  chunk.appendString(`const pool = {};\n`);
76524
- for (const v in spaghetti === null || spaghetti === void 0 ? void 0 : spaghetti.getData().vars) {
76509
+ for (const v in spaghetti?.getData().vars) {
76525
76510
  const abs = spaghetti.getData().vars[v];
76526
76511
  const name = `pool['${v.toLowerCase()}']`;
76527
76512
  chunk.appendString(`${name} = ${new transpile_types_1.TranspileTypes().toType(abs.getType())};\n`);
76528
76513
  chunk.appendString(traversal_1.Traversal.setValues(abs, name));
76529
76514
  }
76530
- for (const t in spaghetti === null || spaghetti === void 0 ? void 0 : spaghetti.getData().types) {
76515
+ for (const t in spaghetti?.getData().types) {
76531
76516
  const abs = spaghetti.getData().types[t];
76532
76517
  chunk.appendString(`pool['${t.toLowerCase()}'] = ${new transpile_types_1.TranspileTypes().toType(abs.getType())};\n`);
76533
76518
  }
@@ -76565,8 +76550,7 @@ const transpile_types_1 = __webpack_require__(/*! ../transpile_types */ "./node_
76565
76550
  // view, much like the tables
76566
76551
  class HandleView {
76567
76552
  runObject(obj, reg) {
76568
- var _a;
76569
- const filename = (_a = obj.getXMLFile()) === null || _a === void 0 ? void 0 : _a.getFilename().replace(".xml", ".mjs").toLowerCase();
76553
+ const filename = obj.getXMLFile()?.getFilename().replace(".xml", ".mjs").toLowerCase();
76570
76554
  if (filename === undefined) {
76571
76555
  return [];
76572
76556
  }
@@ -76607,8 +76591,7 @@ exports.HandleW3MI = void 0;
76607
76591
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
76608
76592
  class HandleW3MI {
76609
76593
  runObject(obj, _reg) {
76610
- var _a;
76611
- const filename = (_a = obj.getXMLFile()) === null || _a === void 0 ? void 0 : _a.getFilename().replace(".xml", ".mjs").toLowerCase();
76594
+ const filename = obj.getXMLFile()?.getFilename().replace(".xml", ".mjs").toLowerCase();
76612
76595
  if (filename === undefined) {
76613
76596
  return [];
76614
76597
  }
@@ -76616,7 +76599,7 @@ class HandleW3MI {
76616
76599
  const dataFile = obj.getDataFile();
76617
76600
  const chunk = new chunk_1.Chunk().appendString(`abap.W3MI["${obj.getName().toUpperCase()}"] = {
76618
76601
  "objectType": "W3MI",
76619
- "filename": ${JSON.stringify(dataFile === null || dataFile === void 0 ? void 0 : dataFile.getFilename())},
76602
+ "filename": ${JSON.stringify(dataFile?.getFilename())},
76620
76603
  };`);
76621
76604
  const output = {
76622
76605
  object: {
@@ -76635,8 +76618,8 @@ class HandleW3MI {
76635
76618
  name: obj.getName(),
76636
76619
  type: obj.getType(),
76637
76620
  },
76638
- filename: dataFile === null || dataFile === void 0 ? void 0 : dataFile.getFilename(),
76639
- chunk: new chunk_1.Chunk().appendString(dataFile === null || dataFile === void 0 ? void 0 : dataFile.getRaw()),
76621
+ filename: dataFile?.getFilename(),
76622
+ chunk: new chunk_1.Chunk().appendString(dataFile?.getRaw()),
76640
76623
  requires: [],
76641
76624
  exports: [],
76642
76625
  };
@@ -76696,23 +76679,22 @@ class Transpiler {
76696
76679
  return new Transpiler().run(reg);
76697
76680
  }
76698
76681
  async run(reg, progress) {
76699
- var _a, _b, _c, _d, _e;
76700
76682
  reg.parse();
76701
- new keywords_1.Keywords((_a = this.options) === null || _a === void 0 ? void 0 : _a.keywords).handle(reg);
76683
+ new keywords_1.Keywords(this.options?.keywords).handle(reg);
76702
76684
  this.validate(reg);
76703
76685
  const dbSetup = new db_1.DatabaseSetup(reg).run(this.options);
76704
76686
  const output = {
76705
76687
  objects: [],
76706
- unitTestScript: new unit_test_1.UnitTest().unitTestScript(reg, (_b = this.options) === null || _b === void 0 ? void 0 : _b.skip),
76707
- unitTestScriptOpen: new unit_test_1.UnitTest().unitTestScriptOpen(reg, (_c = this.options) === null || _c === void 0 ? void 0 : _c.skip),
76708
- initializationScript: new unit_test_1.UnitTest().initializationScript(reg, dbSetup, (_d = this.options) === null || _d === void 0 ? void 0 : _d.extraSetup),
76709
- initializationScript2: new unit_test_1.UnitTest().initializationScript(reg, dbSetup, (_e = this.options) === null || _e === void 0 ? void 0 : _e.extraSetup, true),
76688
+ unitTestScript: new unit_test_1.UnitTest().unitTestScript(reg, this.options?.skip),
76689
+ unitTestScriptOpen: new unit_test_1.UnitTest().unitTestScriptOpen(reg, this.options?.skip),
76690
+ initializationScript: new unit_test_1.UnitTest().initializationScript(reg, dbSetup, this.options?.extraSetup),
76691
+ initializationScript2: new unit_test_1.UnitTest().initializationScript(reg, dbSetup, this.options?.extraSetup, true),
76710
76692
  databaseSetup: dbSetup,
76711
76693
  reg: reg,
76712
76694
  };
76713
- progress === null || progress === void 0 ? void 0 : progress.set(reg.getObjectCount(false), "Building");
76695
+ progress?.set(reg.getObjectCount(false), "Building");
76714
76696
  for (const obj of reg.getObjects()) {
76715
- await (progress === null || progress === void 0 ? void 0 : progress.tick("Building, " + obj.getName()));
76697
+ await progress?.tick("Building, " + obj.getName());
76716
76698
  if (obj instanceof abaplint.ABAPObject && !(obj instanceof abaplint.Objects.TypePool)) {
76717
76699
  output.objects.push(...new handle_abap_1.HandleABAP(this.options).runObject(obj, reg));
76718
76700
  }
@@ -77006,7 +76988,6 @@ class Requires {
77006
76988
  }
77007
76989
  // todo, refactor this method
77008
76990
  find(obj, _node, filename) {
77009
- var _a, _b, _c, _d, _e, _f, _g, _h;
77010
76991
  const ret = [];
77011
76992
  if (obj.getType() === "INTF") {
77012
76993
  return [];
@@ -77026,19 +77007,19 @@ class Requires {
77026
77007
  if (obj.getType() === "CLAS") {
77027
77008
  // add the superclass
77028
77009
  const clas = obj;
77029
- const sup = (_b = (_a = clas.getDefinition()) === null || _a === void 0 ? void 0 : _a.getSuperClass()) === null || _b === void 0 ? void 0 : _b.toLowerCase().replace(/\//g, "#");
77010
+ const sup = clas.getDefinition()?.getSuperClass()?.toLowerCase().replace(/\//g, "#");
77030
77011
  if (sup) {
77031
- add({ filename: sup + ".clas.abap", name: (_d = (_c = clas.getDefinition()) === null || _c === void 0 ? void 0 : _c.getSuperClass()) === null || _d === void 0 ? void 0 : _d.toLowerCase() });
77012
+ add({ filename: sup + ".clas.abap", name: clas.getDefinition()?.getSuperClass()?.toLowerCase() });
77032
77013
  }
77033
77014
  for (const f of clas.getSequencedFiles()) {
77034
77015
  if (filename.endsWith(".testclasses.abap")) {
77035
77016
  // add the global class, in case its inherited by a local testclass
77036
- add({ filename: ((_e = clas.getMainABAPFile()) === null || _e === void 0 ? void 0 : _e.getFilename()) || "", name: obj.getName().toLowerCase() });
77017
+ add({ filename: clas.getMainABAPFile()?.getFilename() || "", name: obj.getName().toLowerCase() });
77037
77018
  }
77038
77019
  if (f.getFilename() === filename
77039
77020
  || f.getFilename().endsWith(".clas.testclasses.abap")
77040
77021
  || f.getFilename().endsWith(".clas.macros.abap")
77041
- || f.getFilename() === ((_f = clas.getMainABAPFile()) === null || _f === void 0 ? void 0 : _f.getFilename())) {
77022
+ || f.getFilename() === clas.getMainABAPFile()?.getFilename()) {
77042
77023
  continue;
77043
77024
  }
77044
77025
  let foo = f.getFilename();
@@ -77059,7 +77040,7 @@ class Requires {
77059
77040
  if (obj.getType() !== "INTF") {
77060
77041
  const cx = this.reg.getObject("CLAS", "CX_ROOT");
77061
77042
  if (cx && cx instanceof abaplint.ABAPObject) {
77062
- const main = (_g = cx.getMainABAPFile()) === null || _g === void 0 ? void 0 : _g.getFilename();
77043
+ const main = cx.getMainABAPFile()?.getFilename();
77063
77044
  if (main) {
77064
77045
  add({
77065
77046
  filename: main,
@@ -77075,7 +77056,7 @@ class Requires {
77075
77056
  }
77076
77057
  const found = this.reg.getObject("CLAS", c.superClassName);
77077
77058
  if (found && found instanceof abaplint.ABAPObject) {
77078
- const main = (_h = found.getMainABAPFile()) === null || _h === void 0 ? void 0 : _h.getFilename();
77059
+ const main = found.getMainABAPFile()?.getFilename();
77079
77060
  if (main) {
77080
77061
  add({
77081
77062
  filename: main,
@@ -77248,9 +77229,8 @@ const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/
77248
77229
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
77249
77230
  class AssignTranspiler {
77250
77231
  transpile(node, traversal) {
77251
- var _a, _b;
77252
77232
  const assignSource = node.findDirectExpression(abaplint.Expressions.AssignSource);
77253
- const sources = (assignSource === null || assignSource === void 0 ? void 0 : assignSource.findDirectExpressionsMulti([abaplint.Expressions.Source, abaplint.Expressions.SimpleSource3]).map(e => new expressions_1.SourceTranspiler(false).transpile(e, traversal).getCode())) || [];
77233
+ const sources = assignSource?.findDirectExpressionsMulti([abaplint.Expressions.Source, abaplint.Expressions.SimpleSource3]).map(e => new expressions_1.SourceTranspiler(false).transpile(e, traversal).getCode()) || [];
77254
77234
  const fs = new expressions_1.FieldSymbolTranspiler().transpile(node.findDirectExpression(abaplint.Expressions.FSTarget), traversal).getCode();
77255
77235
  const options = [];
77256
77236
  const concat = node.concatTokens().toUpperCase();
@@ -77259,19 +77239,19 @@ class AssignTranspiler {
77259
77239
  }
77260
77240
  options.push("target: " + fs);
77261
77241
  if (sources.length !== 0
77262
- && (assignSource === null || assignSource === void 0 ? void 0 : assignSource.findDirectExpression(abaplint.Expressions.Dynamic)) === undefined) {
77242
+ && assignSource?.findDirectExpression(abaplint.Expressions.Dynamic) === undefined) {
77263
77243
  options.push("source: " + sources.pop());
77264
77244
  }
77265
77245
  else {
77266
77246
  let dynamicName = "";
77267
- for (const c of (assignSource === null || assignSource === void 0 ? void 0 : assignSource.getChildren()) || []) {
77247
+ for (const c of assignSource?.getChildren() || []) {
77268
77248
  if (c instanceof abaplint.Nodes.ExpressionNode
77269
77249
  && c.get() instanceof abaplint.Expressions.Dynamic
77270
77250
  && c.findFirstExpression(abaplint.Expressions.ConstantString)) {
77271
77251
  if (dynamicName !== "") {
77272
77252
  dynamicName += " + ";
77273
77253
  }
77274
- dynamicName += (_a = c.findFirstExpression(abaplint.Expressions.ConstantString)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr();
77254
+ dynamicName += c.findFirstExpression(abaplint.Expressions.ConstantString)?.getFirstToken().getStr();
77275
77255
  }
77276
77256
  else if (c instanceof abaplint.Nodes.ExpressionNode
77277
77257
  && c.get() instanceof abaplint.Expressions.Dynamic
@@ -77296,17 +77276,17 @@ class AssignTranspiler {
77296
77276
  }
77297
77277
  options.push(`dynamicName: ` + dynamicName);
77298
77278
  // dynamicSource is the first part of the dynamic part
77299
- const first = assignSource === null || assignSource === void 0 ? void 0 : assignSource.getFirstChild();
77300
- if ((first === null || first === void 0 ? void 0 : first.get()) instanceof abaplint.Expressions.Dynamic && first instanceof abaplint.Nodes.ExpressionNode) {
77279
+ const first = assignSource?.getFirstChild();
77280
+ if (first?.get() instanceof abaplint.Expressions.Dynamic && first instanceof abaplint.Nodes.ExpressionNode) {
77301
77281
  const firstFirst = first.getChildren()[1];
77302
- if ((firstFirst === null || firstFirst === void 0 ? void 0 : firstFirst.get()) instanceof abaplint.Expressions.Constant) {
77303
- const s = (_b = firstFirst.getFirstToken().getStr().toLowerCase().match(/\w+/)) === null || _b === void 0 ? void 0 : _b.toString();
77282
+ if (firstFirst?.get() instanceof abaplint.Expressions.Constant) {
77283
+ const s = firstFirst.getFirstToken().getStr().toLowerCase().match(/\w+/)?.toString();
77304
77284
  options.push(`dynamicSource: (() => {
77305
77285
  try { return ${s}; } catch {}
77306
77286
  try { return this.${s}; } catch {}
77307
77287
  })()`);
77308
77288
  }
77309
- else if ((firstFirst === null || firstFirst === void 0 ? void 0 : firstFirst.get()) instanceof abaplint.Expressions.FieldChain && firstFirst instanceof abaplint.Nodes.ExpressionNode) {
77289
+ else if (firstFirst?.get() instanceof abaplint.Expressions.FieldChain && firstFirst instanceof abaplint.Nodes.ExpressionNode) {
77310
77290
  const code = new expressions_1.FieldChainTranspiler(true).transpile(firstFirst, traversal).getCode();
77311
77291
  options.push(`dynamicSource: (() => {
77312
77292
  const name = ${code}.toLowerCase().replace(/[~\\/]/g, "$").match(/[\\w\\$\\/]+/)[0];
@@ -77315,7 +77295,7 @@ class AssignTranspiler {
77315
77295
  })()`);
77316
77296
  }
77317
77297
  }
77318
- else if ((first === null || first === void 0 ? void 0 : first.get()) instanceof abaplint.Expressions.Source && first instanceof abaplint.Nodes.ExpressionNode) {
77298
+ else if (first?.get() instanceof abaplint.Expressions.Source && first instanceof abaplint.Nodes.ExpressionNode) {
77319
77299
  // const name = first.concatTokens().toLowerCase();
77320
77300
  const name = new expressions_1.SourceTranspiler().transpile(first, traversal).getCode();
77321
77301
  options.push(`dynamicSource: (() => {
@@ -77462,12 +77442,11 @@ const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/tr
77462
77442
  const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/@abaplint/transpiler/build/src/expressions/index.js");
77463
77443
  class CallTranspiler {
77464
77444
  transpile(node, traversal) {
77465
- var _a, _b, _c, _d;
77466
77445
  const chain = node.findDirectExpression(abaplint.Expressions.MethodCallChain);
77467
77446
  if (chain) {
77468
77447
  let pre = "";
77469
77448
  let post = "";
77470
- const receiving = (_b = (_a = chain.findFirstExpression(abaplint.Expressions.MethodParameters)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(abaplint.Expressions.ParameterT)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(abaplint.Expressions.Target);
77449
+ const receiving = chain.findFirstExpression(abaplint.Expressions.MethodParameters)?.findDirectExpression(abaplint.Expressions.ParameterT)?.findDirectExpression(abaplint.Expressions.Target);
77471
77450
  if (receiving) {
77472
77451
  pre = traversal.traverse(receiving).getCode() + ".set(";
77473
77452
  post = ")";
@@ -77493,15 +77472,15 @@ class CallTranspiler {
77493
77472
  const methodSource = node.findDirectExpression(abaplint.Expressions.MethodSource);
77494
77473
  if (methodSource) {
77495
77474
  let body = "";
77496
- const nameToken = (_c = methodSource.getLastChild()) === null || _c === void 0 ? void 0 : _c.getFirstToken();
77475
+ const nameToken = methodSource.getLastChild()?.getFirstToken();
77497
77476
  const m = nameToken ? traversal.findMethodReference(nameToken, traversal.findCurrentScopeByToken(nameToken)) : undefined;
77498
77477
  const methodCallBody = node.findDirectExpression(abaplint.Expressions.MethodCallBody);
77499
77478
  if (methodCallBody) {
77500
- body = new expressions_1.MethodCallBodyTranspiler(m === null || m === void 0 ? void 0 : m.def).transpile(methodCallBody, traversal).getCode();
77479
+ body = new expressions_1.MethodCallBodyTranspiler(m?.def).transpile(methodCallBody, traversal).getCode();
77501
77480
  }
77502
77481
  let pre = "";
77503
77482
  let post = "";
77504
- const receiving = (_d = node.findFirstExpression(abaplint.Expressions.MethodParameters)) === null || _d === void 0 ? void 0 : _d.findExpressionAfterToken("RECEIVING");
77483
+ const receiving = node.findFirstExpression(abaplint.Expressions.MethodParameters)?.findExpressionAfterToken("RECEIVING");
77505
77484
  if (receiving) {
77506
77485
  const target = traversal.traverse(receiving.findDirectExpression(abaplint.Expressions.Target));
77507
77486
  pre = target.getCode() + ".set(";
@@ -77526,7 +77505,6 @@ class CallTranspiler {
77526
77505
  throw new Error("CallTranspiler, todo");
77527
77506
  }
77528
77507
  static buildExceptions(node) {
77529
- var _a;
77530
77508
  let pre = "";
77531
77509
  let post = "";
77532
77510
  pre = "try {\n" + pre;
@@ -77536,7 +77514,7 @@ if (e.classic) {
77536
77514
  switch (e.classic.toUpperCase()) {\n`;
77537
77515
  for (const e of node.findAllExpressions(abaplint.Expressions.ParameterException)) {
77538
77516
  const name = e.getFirstToken().getStr().toUpperCase();
77539
- const value = (_a = e.findFirstExpression(abaplint.Expressions.SimpleName)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr().toUpperCase();
77517
+ const value = e.findFirstExpression(abaplint.Expressions.SimpleName)?.getFirstToken().getStr().toUpperCase();
77540
77518
  if (value === undefined) {
77541
77519
  continue;
77542
77520
  }
@@ -77576,8 +77554,7 @@ const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/
77576
77554
  const call_1 = __webpack_require__(/*! ./call */ "./node_modules/@abaplint/transpiler/build/src/statements/call.js");
77577
77555
  class CallFunctionTranspiler {
77578
77556
  transpile(node, traversal) {
77579
- var _a, _b;
77580
- const fmchild = (_a = node.findDirectExpression(abaplint.Expressions.FunctionName)) === null || _a === void 0 ? void 0 : _a.getFirstChild();
77557
+ const fmchild = node.findDirectExpression(abaplint.Expressions.FunctionName)?.getFirstChild();
77581
77558
  if (fmchild === undefined) {
77582
77559
  throw new Error("CallFunctionTranspilerNameNotFound");
77583
77560
  }
@@ -77601,7 +77578,7 @@ class CallFunctionTranspiler {
77601
77578
  ret.appendString("try {\n");
77602
77579
  }
77603
77580
  const calling = node.findExpressionAfterToken("CALLING");
77604
- const dest = (_b = node.findDirectExpression(abaplint.Expressions.Destination)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(abaplint.Expressions.Source);
77581
+ const dest = node.findDirectExpression(abaplint.Expressions.Destination)?.findDirectExpression(abaplint.Expressions.Source);
77605
77582
  if (dest) {
77606
77583
  const s = new expressions_1.SourceTranspiler(true).transpile(dest, traversal);
77607
77584
  param = param.replace("{", ",").replace(/}$/, "");
@@ -77721,10 +77698,9 @@ const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abap
77721
77698
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
77722
77699
  class CallTransformationTranspiler {
77723
77700
  transpile(node, traversal) {
77724
- var _a;
77725
77701
  const lookup = traversal.lookupClassOrInterface("KERNEL_CALL_TRANSFORMATION", node.getFirstToken());
77726
77702
  const options = [];
77727
- const name = (_a = node.findDirectExpression(abaplint.Expressions.NamespaceSimpleName)) === null || _a === void 0 ? void 0 : _a.concatTokens();
77703
+ const name = node.findDirectExpression(abaplint.Expressions.NamespaceSimpleName)?.concatTokens();
77728
77704
  options.push("name: \"" + name + "\"");
77729
77705
  const sourceXML = node.findDirectExpression(abaplint.Expressions.SimpleSource3);
77730
77706
  if (sourceXML) {
@@ -77876,7 +77852,6 @@ const traversal_1 = __webpack_require__(/*! ../traversal */ "./node_modules/@aba
77876
77852
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
77877
77853
  class ClassImplementationTranspiler {
77878
77854
  transpile(node, traversal) {
77879
- var _a;
77880
77855
  const token = node.findFirstExpression(abaplint.Expressions.ClassName).getFirstToken();
77881
77856
  const def = traversal.getClassDefinition(token);
77882
77857
  let ret = "class " + traversal_1.Traversal.escapeNamespace(token.getStr().toLowerCase());
@@ -77884,8 +77859,8 @@ class ClassImplementationTranspiler {
77884
77859
  // special case for exceptions
77885
77860
  ret += " extends Error";
77886
77861
  }
77887
- else if (def === null || def === void 0 ? void 0 : def.getSuperClass()) {
77888
- ret += " extends " + traversal_1.Traversal.escapeNamespace((_a = def === null || def === void 0 ? void 0 : def.getSuperClass()) === null || _a === void 0 ? void 0 : _a.toLowerCase());
77862
+ else if (def?.getSuperClass()) {
77863
+ ret += " extends " + traversal_1.Traversal.escapeNamespace(def?.getSuperClass()?.toLowerCase());
77889
77864
  }
77890
77865
  const scope = traversal.findCurrentScopeByToken(token);
77891
77866
  return new chunk_1.Chunk().append(ret + ` {
@@ -77919,7 +77894,7 @@ static METHODS = {${traversal.buildMethods(def, scope).join(",\n")}};`, node, tr
77919
77894
  while (sup !== undefined) {
77920
77895
  const sdef = traversal.findClassDefinition(sup, scope);
77921
77896
  list.push(...this.findImplementedByClass(traversal, sdef, scope));
77922
- sup = sdef === null || sdef === void 0 ? void 0 : sdef.getSuperClass();
77897
+ sup = sdef?.getSuperClass();
77923
77898
  }
77924
77899
  return list;
77925
77900
  }
@@ -78124,7 +78099,6 @@ const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abap
78124
78099
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
78125
78100
  class ConcatenateTranspiler {
78126
78101
  transpile(node, traversal) {
78127
- var _a;
78128
78102
  const concat = node.concatTokens().toUpperCase();
78129
78103
  const slist = [];
78130
78104
  for (const s of node.findDirectExpressions(abaplint.Expressions.Source)) {
@@ -78132,7 +78106,7 @@ class ConcatenateTranspiler {
78132
78106
  }
78133
78107
  let extra = "";
78134
78108
  if (node.findExpressionAfterToken("BY")) {
78135
- extra = `, separatedBy: ${(_a = slist.pop()) === null || _a === void 0 ? void 0 : _a.getCode()}`;
78109
+ extra = `, separatedBy: ${slist.pop()?.getCode()}`;
78136
78110
  }
78137
78111
  if (concat.startsWith("CONCATENATE LINES OF ")) {
78138
78112
  extra += ", lines: true";
@@ -78242,31 +78216,31 @@ class ConvertTranspiler {
78242
78216
  const source = [];
78243
78217
  const target = [];
78244
78218
  const date = node.findExpressionAfterToken("DATE");
78245
- if ((date === null || date === void 0 ? void 0 : date.get()) instanceof abaplint.Expressions.Source) {
78219
+ if (date?.get() instanceof abaplint.Expressions.Source) {
78246
78220
  source.push("date: " + new expressions_1.SourceTranspiler().transpile(date, traversal).getCode());
78247
78221
  }
78248
- else if ((date === null || date === void 0 ? void 0 : date.get()) instanceof abaplint.Expressions.Target) {
78222
+ else if (date?.get() instanceof abaplint.Expressions.Target) {
78249
78223
  target.push("date: " + new expressions_1.TargetTranspiler().transpile(date, traversal).getCode());
78250
78224
  }
78251
78225
  const time = node.findExpressionAfterToken("TIME");
78252
- if ((time === null || time === void 0 ? void 0 : time.get()) instanceof abaplint.Expressions.Source) {
78226
+ if (time?.get() instanceof abaplint.Expressions.Source) {
78253
78227
  source.push("time: " + new expressions_1.SourceTranspiler().transpile(time, traversal).getCode());
78254
78228
  }
78255
- else if ((time === null || time === void 0 ? void 0 : time.get()) instanceof abaplint.Expressions.Target) {
78229
+ else if (time?.get() instanceof abaplint.Expressions.Target) {
78256
78230
  target.push("time: " + new expressions_1.TargetTranspiler().transpile(time, traversal).getCode());
78257
78231
  }
78258
78232
  const stamp = node.findExpressionAfterToken("STAMP");
78259
- if ((stamp === null || stamp === void 0 ? void 0 : stamp.get()) instanceof abaplint.Expressions.Source) {
78233
+ if (stamp?.get() instanceof abaplint.Expressions.Source) {
78260
78234
  source.push("stamp: " + new expressions_1.SourceTranspiler().transpile(stamp, traversal).getCode());
78261
78235
  }
78262
- else if ((stamp === null || stamp === void 0 ? void 0 : stamp.get()) instanceof abaplint.Expressions.Target) {
78236
+ else if (stamp?.get() instanceof abaplint.Expressions.Target) {
78263
78237
  target.push("stamp: " + new expressions_1.TargetTranspiler().transpile(stamp, traversal).getCode());
78264
78238
  }
78265
78239
  const zone = node.findExpressionAfterToken("ZONE");
78266
- if ((zone === null || zone === void 0 ? void 0 : zone.get()) instanceof abaplint.Expressions.Source) {
78240
+ if (zone?.get() instanceof abaplint.Expressions.Source) {
78267
78241
  source.push("zone: " + new expressions_1.SourceTranspiler().transpile(zone, traversal).getCode());
78268
78242
  }
78269
- else if ((zone === null || zone === void 0 ? void 0 : zone.get()) instanceof abaplint.Expressions.Target) {
78243
+ else if (zone?.get() instanceof abaplint.Expressions.Target) {
78270
78244
  target.push("zone: " + new expressions_1.TargetTranspiler().transpile(zone, traversal).getCode());
78271
78245
  }
78272
78246
  return new chunk_1.Chunk(`abap.statements.convert({${source.join(",")}}, {${target.join(",")}});`);
@@ -78293,24 +78267,23 @@ const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/
78293
78267
  const transpile_types_1 = __webpack_require__(/*! ../transpile_types */ "./node_modules/@abaplint/transpiler/build/src/transpile_types.js");
78294
78268
  class CreateDataTranspiler {
78295
78269
  transpile(node, traversal) {
78296
- var _a, _b, _c;
78297
78270
  const targetNode = node.findDirectExpression(abaplint.Expressions.Target);
78298
78271
  const target = traversal.traverse(targetNode);
78299
78272
  const concat = node.concatTokens().toUpperCase();
78300
78273
  const options = [];
78301
- let dynamic = (_a = node.findDirectExpression(abaplint.Expressions.Dynamic)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(abaplint.Expressions.ConstantString);
78274
+ let dynamic = node.findDirectExpression(abaplint.Expressions.Dynamic)?.findFirstExpression(abaplint.Expressions.ConstantString);
78302
78275
  if (dynamic) {
78303
78276
  options.push(`"name": ` + dynamic.getFirstToken().getStr());
78304
78277
  }
78305
78278
  else {
78306
- dynamic = (_b = node.findDirectExpression(abaplint.Expressions.Dynamic)) === null || _b === void 0 ? void 0 : _b.findFirstExpression(abaplint.Expressions.FieldChain);
78279
+ dynamic = node.findDirectExpression(abaplint.Expressions.Dynamic)?.findFirstExpression(abaplint.Expressions.FieldChain);
78307
78280
  if (dynamic) {
78308
78281
  options.push(`"name": ` + new expressions_1.FieldChainTranspiler(true).transpile(dynamic, traversal).getCode());
78309
78282
  }
78310
78283
  }
78311
78284
  const typeNameNode = node.findDirectExpression(abaplint.Expressions.TypeName);
78312
78285
  if (typeNameNode) {
78313
- const id = (_c = traversal.findCurrentScopeByToken(typeNameNode.getFirstToken())) === null || _c === void 0 ? void 0 : _c.findType(typeNameNode.concatTokens());
78286
+ const id = traversal.findCurrentScopeByToken(typeNameNode.getFirstToken())?.findType(typeNameNode.concatTokens());
78314
78287
  if (id) {
78315
78288
  options.push(`"type": ` + new transpile_types_1.TranspileTypes().toType(id.getType()));
78316
78289
  }
@@ -78381,7 +78354,6 @@ const unique_identifier_1 = __webpack_require__(/*! ../unique_identifier */ "./n
78381
78354
  const types_1 = __webpack_require__(/*! ../types */ "./node_modules/@abaplint/transpiler/build/src/types.js");
78382
78355
  class CreateObjectTranspiler {
78383
78356
  transpile(node, traversal) {
78384
- var _a, _b;
78385
78357
  const target = traversal.traverse(node.findDirectExpression(abaplint.Expressions.Target)).getCode();
78386
78358
  let para = "";
78387
78359
  const parameters = node.findFirstExpression(abaplint.Expressions.ParameterListS);
@@ -78390,13 +78362,13 @@ class CreateObjectTranspiler {
78390
78362
  }
78391
78363
  let name = "";
78392
78364
  let directGlobal = false;
78393
- let dynamic = (_a = node.findDirectExpression(abaplint.Expressions.Dynamic)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(abaplint.Expressions.ConstantString);
78365
+ let dynamic = node.findDirectExpression(abaplint.Expressions.Dynamic)?.findFirstExpression(abaplint.Expressions.ConstantString);
78394
78366
  if (dynamic) {
78395
78367
  name = dynamic.getFirstToken().getStr();
78396
78368
  // name = name.substring(1, name.length - 1);
78397
78369
  }
78398
78370
  else {
78399
- dynamic = (_b = node.findDirectExpression(abaplint.Expressions.Dynamic)) === null || _b === void 0 ? void 0 : _b.findFirstExpression(abaplint.Expressions.FieldChain);
78371
+ dynamic = node.findDirectExpression(abaplint.Expressions.Dynamic)?.findFirstExpression(abaplint.Expressions.FieldChain);
78400
78372
  if (dynamic) {
78401
78373
  name = new expressions_1.FieldChainTranspiler(true).transpile(dynamic, traversal).getCode();
78402
78374
  directGlobal = true;
@@ -78419,7 +78391,6 @@ class CreateObjectTranspiler {
78419
78391
  return new chunk_1.Chunk(ret);
78420
78392
  }
78421
78393
  findClassName(node, traversal) {
78422
- var _a;
78423
78394
  const c = node.findDirectExpression(abaplint.Expressions.ClassName);
78424
78395
  if (c) {
78425
78396
  return c.concatTokens();
@@ -78434,14 +78405,14 @@ class CreateObjectTranspiler {
78434
78405
  }
78435
78406
  const type = traversal.determineType(node, scope);
78436
78407
  if (type === undefined) {
78437
- throw new Error(`CreateObjectTranspiler, target variable "${target === null || target === void 0 ? void 0 : target.concatTokens()}" not found in scope`);
78408
+ throw new Error(`CreateObjectTranspiler, target variable "${target?.concatTokens()}" not found in scope`);
78438
78409
  }
78439
78410
  else if (type instanceof abaplint.BasicTypes.GenericObjectReferenceType) {
78440
78411
  return "object";
78441
78412
  }
78442
78413
  else if (!(type instanceof abaplint.BasicTypes.ObjectReferenceType)) {
78443
- if (((_a = traversal.options) === null || _a === void 0 ? void 0 : _a.unknownTypes) !== types_1.UnknownTypesEnum.runtimeError) {
78444
- throw new Error(`CreateObjectTranspiler, target variable "${target === null || target === void 0 ? void 0 : target.concatTokens()}" not a object reference`);
78414
+ if (traversal.options?.unknownTypes !== types_1.UnknownTypesEnum.runtimeError) {
78415
+ throw new Error(`CreateObjectTranspiler, target variable "${target?.concatTokens()}" not a object reference`);
78445
78416
  }
78446
78417
  else {
78447
78418
  return "RUNTIME_ERROR";
@@ -78472,8 +78443,7 @@ const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/
78472
78443
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
78473
78444
  class DataTranspiler {
78474
78445
  transpile(node, traversal) {
78475
- var _a;
78476
- const token = (_a = node.findFirstExpression(abaplint.Expressions.DefinitionName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
78446
+ const token = node.findFirstExpression(abaplint.Expressions.DefinitionName)?.getFirstToken();
78477
78447
  if (token === undefined) {
78478
78448
  throw new Error("DataTranspiler, token not found");
78479
78449
  }
@@ -79068,14 +79038,13 @@ class EndMethodTranspiler {
79068
79038
  return new chunk_1.Chunk().append(returning + "}", node, traversal);
79069
79039
  }
79070
79040
  setSubrc(scope, traversal) {
79071
- var _a, _b;
79072
79041
  let methodName = undefined;
79073
- if ((scope === null || scope === void 0 ? void 0 : scope.getIdentifier().stype) === abaplint.ScopeType.Method) {
79074
- methodName = scope === null || scope === void 0 ? void 0 : scope.getIdentifier().sname;
79042
+ if (scope?.getIdentifier().stype === abaplint.ScopeType.Method) {
79043
+ methodName = scope?.getIdentifier().sname;
79075
79044
  }
79076
79045
  let className = undefined;
79077
- if (((_a = scope === null || scope === void 0 ? void 0 : scope.getParent()) === null || _a === void 0 ? void 0 : _a.getIdentifier().stype) === abaplint.ScopeType.ClassImplementation) {
79078
- className = (_b = scope === null || scope === void 0 ? void 0 : scope.getParent()) === null || _b === void 0 ? void 0 : _b.getIdentifier().sname;
79046
+ if (scope?.getParent()?.getIdentifier().stype === abaplint.ScopeType.ClassImplementation) {
79047
+ className = scope?.getParent()?.getIdentifier().sname;
79079
79048
  }
79080
79049
  if (methodName === undefined || className === undefined) {
79081
79050
  return "";
@@ -79084,11 +79053,11 @@ class EndMethodTranspiler {
79084
79053
  if (methodName.includes("~")) {
79085
79054
  const split = methodName.split("~");
79086
79055
  const classDef = traversal.findInterfaceDefinition(split[0], scope);
79087
- methodDef = classDef === null || classDef === void 0 ? void 0 : classDef.getMethodDefinitions().getByName(split[1]);
79056
+ methodDef = classDef?.getMethodDefinitions().getByName(split[1]);
79088
79057
  }
79089
79058
  else {
79090
79059
  const classDef = traversal.findClassDefinition(className, scope);
79091
- methodDef = classDef === null || classDef === void 0 ? void 0 : classDef.getMethodDefinitions().getByName(methodName);
79060
+ methodDef = classDef?.getMethodDefinitions().getByName(methodName);
79092
79061
  }
79093
79062
  if (methodDef && methodDef.getExceptions().length > 0) {
79094
79063
  return "abap.builtin.sy.get().subrc.set(0);\n";
@@ -79264,7 +79233,7 @@ const transpile_types_1 = __webpack_require__(/*! ../transpile_types */ "./node_
79264
79233
  class FieldSymbolTranspiler {
79265
79234
  transpile(node, traversal) {
79266
79235
  const name = node.findDirectExpression(abaplint.Expressions.FieldSymbol);
79267
- const token = name === null || name === void 0 ? void 0 : name.getFirstToken();
79236
+ const token = name?.getFirstToken();
79268
79237
  if (token === undefined) {
79269
79238
  throw new Error("FieldSymbolTranspiler, token not found");
79270
79239
  }
@@ -79304,15 +79273,14 @@ const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abap
79304
79273
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
79305
79274
  class FindTranspiler {
79306
79275
  transpile(node, traversal) {
79307
- var _a, _b;
79308
79276
  const options = [];
79309
79277
  let index = 1;
79310
79278
  const sources = node.findDirectExpressions(abaplint.Expressions.Source);
79311
79279
  const source0 = traversal.traverse(sources[0]).getCode();
79312
- if ((_a = node.findFirstExpression(abaplint.Expressions.FindType)) === null || _a === void 0 ? void 0 : _a.findDirectTokenByText("REGEX")) {
79280
+ if (node.findFirstExpression(abaplint.Expressions.FindType)?.findDirectTokenByText("REGEX")) {
79313
79281
  options.push("regex: " + source0);
79314
79282
  }
79315
- else if ((_b = node.findFirstExpression(abaplint.Expressions.FindType)) === null || _b === void 0 ? void 0 : _b.findDirectTokenByText("PCRE")) {
79283
+ else if (node.findFirstExpression(abaplint.Expressions.FindType)?.findDirectTokenByText("PCRE")) {
79316
79284
  options.push("pcre: " + source0);
79317
79285
  }
79318
79286
  else {
@@ -79339,7 +79307,7 @@ class FindTranspiler {
79339
79307
  let prev = undefined;
79340
79308
  let off;
79341
79309
  for (const c of node.getChildren()) {
79342
- if ((prev === null || prev === void 0 ? void 0 : prev.getFirstToken().getStr().toUpperCase()) === "OFFSET"
79310
+ if (prev?.getFirstToken().getStr().toUpperCase() === "OFFSET"
79343
79311
  && c.get() instanceof abaplint.Expressions.Target) {
79344
79312
  options.push("offset: " + traversal.traverse(c).getCode());
79345
79313
  off = c;
@@ -79396,16 +79364,16 @@ class FormTranspiler {
79396
79364
  unique_identifier_1.UniqueIdentifier.resetIndexBackup();
79397
79365
  const name = node.findFirstExpression(abaplint.Expressions.FormName).getFirstToken().getStr();
79398
79366
  const scope = traversal.findCurrentScopeByToken(node.getFirstToken());
79399
- const def = scope === null || scope === void 0 ? void 0 : scope.findFormDefinition(name);
79367
+ const def = scope?.findFormDefinition(name);
79400
79368
  const ret = new chunk_1.Chunk("async function " + name + "(INPUT) {");
79401
79369
  const params = [];
79402
- for (const p of (def === null || def === void 0 ? void 0 : def.getChangingParameters()) || []) {
79370
+ for (const p of def?.getChangingParameters() || []) {
79403
79371
  params.push(`let ${p.getName()} = INPUT.${p.getName()};`);
79404
79372
  }
79405
- for (const p of (def === null || def === void 0 ? void 0 : def.getTablesParameters()) || []) {
79373
+ for (const p of def?.getTablesParameters() || []) {
79406
79374
  params.push(`let ${p.getName()} = INPUT.${p.getName()};`);
79407
79375
  }
79408
- for (const p of (def === null || def === void 0 ? void 0 : def.getUsingParameters()) || []) {
79376
+ for (const p of def?.getUsingParameters() || []) {
79409
79377
  params.push(`let ${p.getName()} = INPUT.${p.getName()};`);
79410
79378
  }
79411
79379
  if (params.length > 0) {
@@ -80163,21 +80131,20 @@ class LoopTranspiler {
80163
80131
  this.unique = "";
80164
80132
  this.injectFrom = undefined;
80165
80133
  this.skipInto = undefined;
80166
- this.injectFrom = options === null || options === void 0 ? void 0 : options.injectFrom;
80167
- this.skipInto = options === null || options === void 0 ? void 0 : options.skipInto;
80134
+ this.injectFrom = options?.injectFrom;
80135
+ this.skipInto = options?.skipInto;
80168
80136
  }
80169
80137
  getTarget() {
80170
80138
  return this.unique;
80171
80139
  }
80172
80140
  transpile(node, traversal) {
80173
- var _a, _b, _c;
80174
80141
  if (!(node.get() instanceof abaplint.Statements.Loop)) {
80175
80142
  throw new Error("LoopTranspiler, unexpected node");
80176
80143
  }
80177
80144
  const source = traversal.traverse(node.findDirectExpression(abaplint.Expressions.SimpleSource2)).getCode();
80178
80145
  this.unique = unique_identifier_1.UniqueIdentifier.get();
80179
80146
  let target = "";
80180
- const into = (_a = node.findDirectExpression(abaplint.Expressions.LoopTarget)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(abaplint.Expressions.Target);
80147
+ const into = node.findDirectExpression(abaplint.Expressions.LoopTarget)?.findDirectExpression(abaplint.Expressions.Target);
80181
80148
  if (into && this.skipInto !== true) {
80182
80149
  const concat = node.concatTokens().toUpperCase();
80183
80150
  const t = traversal.traverse(into).getCode();
@@ -80196,7 +80163,7 @@ class LoopTranspiler {
80196
80163
  }
80197
80164
  }
80198
80165
  else if (this.skipInto !== true) {
80199
- const assigning = (_b = node.findFirstExpression(abaplint.Expressions.FSTarget)) === null || _b === void 0 ? void 0 : _b.findFirstExpression(abaplint.Expressions.FieldSymbol);
80166
+ const assigning = node.findFirstExpression(abaplint.Expressions.FSTarget)?.findFirstExpression(abaplint.Expressions.FieldSymbol);
80200
80167
  if (assigning) {
80201
80168
  target = traversal.traverse(assigning).getCode() + ".assign(" + this.unique + ");";
80202
80169
  }
@@ -80239,8 +80206,8 @@ class LoopTranspiler {
80239
80206
  extra.push("where: async " + where);
80240
80207
  }
80241
80208
  const topEquals = {};
80242
- for (const compare of (whereNode === null || whereNode === void 0 ? void 0 : whereNode.findDirectExpressions(abaplint.Expressions.ComponentCompare)) || []) {
80243
- const op = (_c = compare.findDirectExpression(abaplint.Expressions.CompareOperator)) === null || _c === void 0 ? void 0 : _c.concatTokens().toUpperCase();
80209
+ for (const compare of whereNode?.findDirectExpressions(abaplint.Expressions.ComponentCompare) || []) {
80210
+ const op = compare.findDirectExpression(abaplint.Expressions.CompareOperator)?.concatTokens().toUpperCase();
80244
80211
  if (op !== "=" && op !== "EQ") {
80245
80212
  continue;
80246
80213
  }
@@ -80248,7 +80215,7 @@ class LoopTranspiler {
80248
80215
  continue;
80249
80216
  }
80250
80217
  const simple = compare.findDirectExpression(abaplint.Expressions.ComponentChainSimple);
80251
- if ((simple === null || simple === void 0 ? void 0 : simple.getChildren().length) !== 1) {
80218
+ if (simple?.getChildren().length !== 1) {
80252
80219
  continue;
80253
80220
  }
80254
80221
  const tchain = traversal.traverse(simple);
@@ -80426,7 +80393,6 @@ const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/tr
80426
80393
  const unique_identifier_1 = __webpack_require__(/*! ../unique_identifier */ "./node_modules/@abaplint/transpiler/build/src/unique_identifier.js");
80427
80394
  class MethodImplementationTranspiler {
80428
80395
  transpile(node, traversal) {
80429
- var _a, _b, _c;
80430
80396
  const token = node.findFirstExpression(abaplint.Expressions.MethodName).getFirstToken();
80431
80397
  let methodName = token.getStr();
80432
80398
  const scope = traversal.findCurrentScopeByToken(token);
@@ -80457,8 +80423,8 @@ class MethodImplementationTranspiler {
80457
80423
  if (unique === "") {
80458
80424
  unique = "INPUT";
80459
80425
  }
80460
- const parameterDefault = methodDef === null || methodDef === void 0 ? void 0 : methodDef.getParameterDefault(varName);
80461
- const isOptional = methodDef === null || methodDef === void 0 ? void 0 : methodDef.getOptional().includes(varName.toUpperCase());
80426
+ const parameterDefault = methodDef?.getParameterDefault(varName);
80427
+ const isOptional = methodDef?.getOptional().includes(varName.toUpperCase());
80462
80428
  const passByValue = identifier.getMeta().includes("pass_by_value" /* abaplint.IdentifierMeta.PassByValue */);
80463
80429
  const type = identifier.getType();
80464
80430
  if (identifier.getMeta().includes("exporting" /* abaplint.IdentifierMeta.MethodExporting */)) {
@@ -80471,7 +80437,7 @@ class MethodImplementationTranspiler {
80471
80437
  && type.isGeneric() === false) {
80472
80438
  after += `let ${varName} = ${unique}?.${varName};\n`;
80473
80439
  if (identifier.getType().getQualifiedName() !== undefined && identifier.getType().getQualifiedName() !== "") {
80474
- after += `if (${varName}?.getQualifiedName === undefined || ${varName}.getQualifiedName() !== "${(_a = identifier.getType().getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toUpperCase()}") { ${varName} = undefined; }\n`;
80440
+ after += `if (${varName}?.getQualifiedName === undefined || ${varName}.getQualifiedName() !== "${identifier.getType().getQualifiedName()?.toUpperCase()}") { ${varName} = undefined; }\n`;
80475
80441
  }
80476
80442
  after += `if (${varName} === undefined) { ${varName} = ${new transpile_types_1.TranspileTypes().toType(identifier.getType())}.set(${unique}.${varName}); }\n`;
80477
80443
  }
@@ -80501,7 +80467,7 @@ class MethodImplementationTranspiler {
80501
80467
  after += "if (" + unique + " && " + unique + "." + varName + ") {" + varName + " = " + unique + "." + varName + ";}\n";
80502
80468
  }
80503
80469
  if (parameterDefault) {
80504
- const val = this.buildDefault(parameterDefault, traversal, methodDef === null || methodDef === void 0 ? void 0 : methodDef.getFilename());
80470
+ const val = this.buildDefault(parameterDefault, traversal, methodDef?.getFilename());
80505
80471
  if (passByValue === true || identifier.getMeta().includes("changing" /* abaplint.IdentifierMeta.MethodChanging */)) {
80506
80472
  after += "if (" + unique + " === undefined || " + unique + "." + varName + " === undefined) {" + varName + ".set(" + val + ");}\n";
80507
80473
  }
@@ -80526,15 +80492,15 @@ class MethodImplementationTranspiler {
80526
80492
  // it messes up promises when "this" is returned
80527
80493
  throw new Error(`Method name "then" not allowed`);
80528
80494
  }
80529
- const superDef = traversal.findClassDefinition(classDef === null || classDef === void 0 ? void 0 : classDef.getSuperClass(), scope);
80530
- for (const a of (superDef === null || superDef === void 0 ? void 0 : superDef.getAliases().getAll()) || []) {
80495
+ const superDef = traversal.findClassDefinition(classDef?.getSuperClass(), scope);
80496
+ for (const a of superDef?.getAliases().getAll() || []) {
80531
80497
  if (a.getName().toLowerCase() === methodName) {
80532
80498
  methodName = a.getComponent().replace("~", "$").toLowerCase();
80533
80499
  }
80534
80500
  }
80535
80501
  if (method && method.isStatic()) {
80536
80502
  // in ABAP static methods can be called with instance arrows, "->"
80537
- const className = (_c = (_b = scope.getParent()) === null || _b === void 0 ? void 0 : _b.getIdentifier().sname) === null || _c === void 0 ? void 0 : _c.toLowerCase();
80503
+ const className = scope.getParent()?.getIdentifier().sname?.toLowerCase();
80538
80504
  staticMethod = "async " + traversal_1.Traversal.escapeNamespace(methodName) + "(" + unique + ") {\n" +
80539
80505
  "return " + traversal_1.Traversal.escapeNamespace(className) + "." + traversal_1.Traversal.escapeNamespace(methodName) + "(" + unique + ");\n" +
80540
80506
  "}\n" + "static ";
@@ -80616,7 +80582,6 @@ class MethodImplementationTranspiler {
80616
80582
  return val;
80617
80583
  }
80618
80584
  findMethod(name, cdef, traversal) {
80619
- var _a, _b;
80620
80585
  if (cdef === undefined) {
80621
80586
  return undefined;
80622
80587
  }
@@ -80626,10 +80591,10 @@ class MethodImplementationTranspiler {
80626
80591
  name = split[1];
80627
80592
  const scope = traversal.findCurrentScopeByToken(cdef.getToken());
80628
80593
  const intf = traversal.findInterfaceDefinition(intfName, scope);
80629
- return (_a = intf === null || intf === void 0 ? void 0 : intf.getMethodDefinitions()) === null || _a === void 0 ? void 0 : _a.getByName(name);
80594
+ return intf?.getMethodDefinitions()?.getByName(name);
80630
80595
  }
80631
80596
  else {
80632
- return (_b = cdef.getMethodDefinitions()) === null || _b === void 0 ? void 0 : _b.getByName(name);
80597
+ return cdef.getMethodDefinitions()?.getByName(name);
80633
80598
  }
80634
80599
  }
80635
80600
  findMethodParameters(scope) {
@@ -80776,14 +80741,13 @@ const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abap
80776
80741
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
80777
80742
  class MoveTranspiler {
80778
80743
  transpile(node, traversal) {
80779
- var _a;
80780
80744
  let source = traversal.traverse(node.findDirectExpression(abaplint.Expressions.Source));
80781
80745
  const targets = [];
80782
80746
  for (const t of node.findDirectExpressions(abaplint.Expressions.Target)) {
80783
80747
  targets.push(traversal.traverse(t));
80784
80748
  }
80785
80749
  const ret = new chunk_1.Chunk();
80786
- const second = (_a = node.getChildren()[1]) === null || _a === void 0 ? void 0 : _a.concatTokens();
80750
+ const second = node.getChildren()[1]?.concatTokens();
80787
80751
  if (second === "?=") {
80788
80752
  ret.appendString("await abap.statements.cast(")
80789
80753
  .appendChunk(targets[0])
@@ -80853,13 +80817,13 @@ class OpenCursorTranspiler {
80853
80817
  const target = traversal.traverse(node.findDirectExpression(abaplint.Expressions.SQLTarget)).getCode();
80854
80818
  const selectExpression = node.findDirectExpression(abaplint.Expressions.Select);
80855
80819
  let select = "SELECT ";
80856
- select += traversal.traverse(selectExpression === null || selectExpression === void 0 ? void 0 : selectExpression.findDirectExpression(abaplint.Expressions.SQLFieldList)).getCode() + " ";
80857
- select += traversal.traverse(selectExpression === null || selectExpression === void 0 ? void 0 : selectExpression.findDirectExpression(abaplint.Expressions.SQLFrom)).getCode();
80858
- const cond = selectExpression === null || selectExpression === void 0 ? void 0 : selectExpression.findDirectExpression(abaplint.Expressions.SQLCond);
80820
+ select += traversal.traverse(selectExpression?.findDirectExpression(abaplint.Expressions.SQLFieldList)).getCode() + " ";
80821
+ select += traversal.traverse(selectExpression?.findDirectExpression(abaplint.Expressions.SQLFrom)).getCode();
80822
+ const cond = selectExpression?.findDirectExpression(abaplint.Expressions.SQLCond);
80859
80823
  if (cond) {
80860
80824
  select += "WHERE " + traversal.traverse(node).getCode();
80861
80825
  }
80862
- const orderBy = selectExpression === null || selectExpression === void 0 ? void 0 : selectExpression.findDirectExpression(abaplint.Expressions.SQLOrderBy);
80826
+ const orderBy = selectExpression?.findDirectExpression(abaplint.Expressions.SQLOrderBy);
80863
80827
  if (orderBy) {
80864
80828
  select += "ORDER BY " + traversal.traverse(node).getCode();
80865
80829
  }
@@ -80963,7 +80927,6 @@ const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abap
80963
80927
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
80964
80928
  class PerformTranspiler {
80965
80929
  transpile(node, traversal) {
80966
- var _a, _b, _c;
80967
80930
  const formName = node.findDirectExpression(abaplint.Expressions.FormName);
80968
80931
  if (formName === undefined) {
80969
80932
  return new chunk_1.Chunk(`throw new Error("PerformTranspiler FormName not found");`);
@@ -80973,7 +80936,7 @@ class PerformTranspiler {
80973
80936
  }
80974
80937
  let def = undefined;
80975
80938
  const scope = traversal.findCurrentScopeByToken(node.getFirstToken());
80976
- for (const r of (scope === null || scope === void 0 ? void 0 : scope.getData().references) || []) {
80939
+ for (const r of scope?.getData().references || []) {
80977
80940
  if (r.referenceType === abaplint.ReferenceType.FormReference
80978
80941
  && r.position.getStart().equals(formName.getFirstToken().getStart())
80979
80942
  && r.resolved instanceof abaplint.Types.FormDefinition) {
@@ -80983,8 +80946,8 @@ class PerformTranspiler {
80983
80946
  // todo: pass by VALUE()
80984
80947
  const params = [];
80985
80948
  let index = 0;
80986
- for (const t of ((_a = node.findDirectExpression(abaplint.Expressions.PerformTables)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(abaplint.Expressions.Source)) || []) {
80987
- const name = def === null || def === void 0 ? void 0 : def.getTablesParameters()[index].getName().toLowerCase();
80949
+ for (const t of node.findDirectExpression(abaplint.Expressions.PerformTables)?.findDirectExpressions(abaplint.Expressions.Source) || []) {
80950
+ const name = def?.getTablesParameters()[index].getName().toLowerCase();
80988
80951
  if (name === undefined) {
80989
80952
  continue;
80990
80953
  }
@@ -80992,8 +80955,8 @@ class PerformTranspiler {
80992
80955
  index++;
80993
80956
  }
80994
80957
  index = 0;
80995
- for (const u of ((_b = node.findDirectExpression(abaplint.Expressions.PerformUsing)) === null || _b === void 0 ? void 0 : _b.findDirectExpressions(abaplint.Expressions.Source)) || []) {
80996
- const name = def === null || def === void 0 ? void 0 : def.getUsingParameters()[index].getName().toLowerCase();
80958
+ for (const u of node.findDirectExpression(abaplint.Expressions.PerformUsing)?.findDirectExpressions(abaplint.Expressions.Source) || []) {
80959
+ const name = def?.getUsingParameters()[index].getName().toLowerCase();
80997
80960
  if (name === undefined) {
80998
80961
  continue;
80999
80962
  }
@@ -81001,8 +80964,8 @@ class PerformTranspiler {
81001
80964
  index++;
81002
80965
  }
81003
80966
  index = 0;
81004
- for (const c of ((_c = node.findDirectExpression(abaplint.Expressions.PerformChanging)) === null || _c === void 0 ? void 0 : _c.findDirectExpressions(abaplint.Expressions.Source)) || []) {
81005
- const name = def === null || def === void 0 ? void 0 : def.getChangingParameters()[index].getName().toLowerCase();
80967
+ for (const c of node.findDirectExpression(abaplint.Expressions.PerformChanging)?.findDirectExpressions(abaplint.Expressions.Source) || []) {
80968
+ const name = def?.getChangingParameters()[index].getName().toLowerCase();
81006
80969
  if (name === undefined) {
81007
80970
  continue;
81008
80971
  }
@@ -81033,13 +80996,12 @@ const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/
81033
80996
  const unique_identifier_1 = __webpack_require__(/*! ../unique_identifier */ "./node_modules/@abaplint/transpiler/build/src/unique_identifier.js");
81034
80997
  class RaiseTranspiler {
81035
80998
  transpile(node, traversal) {
81036
- var _a, _b;
81037
- const classNameToken = (_a = node.findFirstExpression(abaplint.Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
81038
- const className = classNameToken === null || classNameToken === void 0 ? void 0 : classNameToken.getStr();
80999
+ const classNameToken = node.findFirstExpression(abaplint.Expressions.ClassName)?.getFirstToken();
81000
+ const className = classNameToken?.getStr();
81039
81001
  if (className === undefined) {
81040
81002
  const s = node.findFirstExpression(abaplint.Expressions.SimpleSource2);
81041
81003
  if (s === undefined) {
81042
- const name = (_b = node.findFirstExpression(abaplint.Expressions.ExceptionName)) === null || _b === void 0 ? void 0 : _b.concatTokens().toLowerCase();
81004
+ const name = node.findFirstExpression(abaplint.Expressions.ExceptionName)?.concatTokens().toLowerCase();
81043
81005
  return new chunk_1.Chunk().append(`throw new abap.ClassicError({classic: "${name}"});`, node, traversal);
81044
81006
  }
81045
81007
  const sCode = new expressions_1.SourceTranspiler(true).transpile(s, traversal).getCode();
@@ -81051,7 +81013,7 @@ class RaiseTranspiler {
81051
81013
  p = traversal.traverse(parameters).getCode();
81052
81014
  }
81053
81015
  const extra = `{"INTERNAL_FILENAME": "${traversal.getFilename()}","INTERNAL_LINE": ${node.getStart().getRow()}}`;
81054
- const lookup = traversal.lookupClassOrInterface(classNameToken === null || classNameToken === void 0 ? void 0 : classNameToken.getStr(), classNameToken);
81016
+ const lookup = traversal.lookupClassOrInterface(classNameToken?.getStr(), classNameToken);
81055
81017
  const id = unique_identifier_1.UniqueIdentifier.get();
81056
81018
  return new chunk_1.Chunk().append(`const ${id} = await (new ${lookup}()).constructor_(${p});
81057
81019
  ${id}.EXTRA_CX = ${extra};
@@ -81206,15 +81168,15 @@ class ReadTableTranspiler {
81206
81168
  extra.push("withTableKey: true");
81207
81169
  }
81208
81170
  const rt = node.findDirectExpression(abaplint.Expressions.ReadTableTarget);
81209
- const target = rt === null || rt === void 0 ? void 0 : rt.findDirectExpression(abaplint.Expressions.Target);
81210
- const fs = rt === null || rt === void 0 ? void 0 : rt.findDirectExpression(abaplint.Expressions.FSTarget);
81171
+ const target = rt?.findDirectExpression(abaplint.Expressions.Target);
81172
+ const fs = rt?.findDirectExpression(abaplint.Expressions.FSTarget);
81211
81173
  if (rt && fs) {
81212
81174
  const name = new expressions_1.FieldSymbolTranspiler().transpile(fs, traversal).getCode();
81213
81175
  extra.push("assigning: " + name);
81214
81176
  }
81215
81177
  else if (target) {
81216
81178
  const name = traversal.traverse(target).getCode();
81217
- if (rt === null || rt === void 0 ? void 0 : rt.findDirectTokenByText("REFERENCE")) {
81179
+ if (rt?.findDirectTokenByText("REFERENCE")) {
81218
81180
  extra.push("referenceInto: " + name);
81219
81181
  }
81220
81182
  else {
@@ -81316,8 +81278,7 @@ const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abap
81316
81278
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
81317
81279
  class ReceiveTranspiler {
81318
81280
  transpile(node, traversal) {
81319
- var _a;
81320
- const fmchild = (_a = node.findDirectExpression(abaplint.Expressions.FunctionName)) === null || _a === void 0 ? void 0 : _a.getFirstChild();
81281
+ const fmchild = node.findDirectExpression(abaplint.Expressions.FunctionName)?.getFirstChild();
81321
81282
  if (fmchild === undefined) {
81322
81283
  throw new Error("ReceiveTranspilerNameNotFound");
81323
81284
  }
@@ -81407,7 +81368,7 @@ class ReplaceTranspiler {
81407
81368
  extra.push("sectionOffset: " + new expressions_1.SourceTranspiler().transpile(offset, traversal).getCode());
81408
81369
  }
81409
81370
  const r = node.findDirectExpression(abaplint.Expressions.FindType);
81410
- const type = r === null || r === void 0 ? void 0 : r.concatTokens().toUpperCase();
81371
+ const type = r?.concatTokens().toUpperCase();
81411
81372
  if (type === "REGEX") {
81412
81373
  extra.push("regex: " + new expressions_1.SourceTranspiler().transpile(sources[0], traversal).getCode());
81413
81374
  }
@@ -81490,7 +81451,7 @@ class ReturnTranspiler {
81490
81451
  transpile(node, traversal) {
81491
81452
  let extra = "";
81492
81453
  const scope = traversal.findCurrentScopeByToken(node.getFirstToken());
81493
- const vars = scope === null || scope === void 0 ? void 0 : scope.getData().vars;
81454
+ const vars = scope?.getData().vars;
81494
81455
  for (const n in vars) {
81495
81456
  const identifier = vars[n];
81496
81457
  if (identifier.getMeta().includes("returning" /* abaplint.IdentifierMeta.MethodReturning */)) {
@@ -81501,8 +81462,8 @@ class ReturnTranspiler {
81501
81462
  if (traversal.isInsideDoOrWhile(node)) {
81502
81463
  pre = `abap.builtin.sy.get().index.set(${unique_identifier_1.UniqueIdentifier.getIndexBackup1()});\n`;
81503
81464
  }
81504
- if ((scope === null || scope === void 0 ? void 0 : scope.getIdentifier().stype) === abaplint.ScopeType.Method
81505
- && (scope === null || scope === void 0 ? void 0 : scope.getIdentifier().sname.toLowerCase()) === "constructor") {
81465
+ if (scope?.getIdentifier().stype === abaplint.ScopeType.Method
81466
+ && scope?.getIdentifier().sname.toLowerCase() === "constructor") {
81506
81467
  extra = " this";
81507
81468
  }
81508
81469
  return new chunk_1.Chunk().append(pre + "return" + extra + ";", node, traversal);
@@ -81618,7 +81579,6 @@ function escapeRegExp(string) {
81618
81579
  // TODO: currently SELECT into are always handled as CORRESPONDING
81619
81580
  class SelectTranspiler {
81620
81581
  transpile(node, traversal, targetOverride) {
81621
- var _a;
81622
81582
  let target = "undefined";
81623
81583
  if (targetOverride) {
81624
81584
  // SelectLoop structure uses override
@@ -81695,7 +81655,7 @@ class SelectTranspiler {
81695
81655
  if (node.findFirstExpression(abaplint.Expressions.SQLForAllEntries)) {
81696
81656
  const unique = unique_identifier_1.UniqueIdentifier.get();
81697
81657
  const unique2 = unique_identifier_1.UniqueIdentifier.get();
81698
- const fn = (_a = node.findFirstExpression(abaplint.Expressions.SQLForAllEntries)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(abaplint.Expressions.SQLSource);
81658
+ const fn = node.findFirstExpression(abaplint.Expressions.SQLForAllEntries)?.findDirectExpression(abaplint.Expressions.SQLSource);
81699
81659
  const faeTranspiled = new expressions_1.SQLSourceTranspiler().transpile(fn, traversal).getCode();
81700
81660
  select = select.replace(new RegExp(" " + escapeRegExp(faeTranspiled), "g"), " " + unique);
81701
81661
  select = select.replace(unique + ".get().table_line.get()", unique + ".get()"); // there can be only one?
@@ -82314,8 +82274,7 @@ const transpile_types_1 = __webpack_require__(/*! ../transpile_types */ "./node_
82314
82274
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
82315
82275
  class TablesTranspiler {
82316
82276
  transpile(node, traversal) {
82317
- var _a;
82318
- const token = (_a = node.findFirstExpression(abaplint.Expressions.Field)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
82277
+ const token = node.findFirstExpression(abaplint.Expressions.Field)?.getFirstToken();
82319
82278
  if (token === undefined) {
82320
82279
  throw new Error("TablesTranspiler, token not found");
82321
82280
  }
@@ -82682,10 +82641,9 @@ const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abap
82682
82641
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
82683
82642
  class WriteTranspiler {
82684
82643
  transpile(node, traversal) {
82685
- var _a;
82686
82644
  const extra = [];
82687
82645
  let source;
82688
- const newLine = ((_a = node.findFirstExpression(abaplint.Expressions.WriteOffsetLength)) === null || _a === void 0 ? void 0 : _a.findDirectTokenByText("/")) !== undefined;
82646
+ const newLine = node.findFirstExpression(abaplint.Expressions.WriteOffsetLength)?.findDirectTokenByText("/") !== undefined;
82689
82647
  const concat = node.concatTokens().toUpperCase();
82690
82648
  const target = node.findDirectExpression(abaplint.Expressions.Target);
82691
82649
  if (target) {
@@ -82755,16 +82713,18 @@ const statements_1 = __webpack_require__(/*! ../statements */ "./node_modules/@a
82755
82713
  const unique_identifier_1 = __webpack_require__(/*! ../unique_identifier */ "./node_modules/@abaplint/transpiler/build/src/unique_identifier.js");
82756
82714
  class AtTranspiler {
82757
82715
  transpile(node, traversal, previous, loopTarget, tabix, loopStatement) {
82758
- var _a, _b;
82759
82716
  const ret = new chunk_1.Chunk();
82760
82717
  const atStatement = node.findDirectStatement(abaplint.Statements.At);
82761
- const concat = atStatement === null || atStatement === void 0 ? void 0 : atStatement.concatTokens().toUpperCase();
82762
- const name = (_b = (_a = atStatement === null || atStatement === void 0 ? void 0 : atStatement.findDirectExpression(abaplint.Expressions.FieldSub)) === null || _a === void 0 ? void 0 : _a.concatTokens()) === null || _b === void 0 ? void 0 : _b.toLowerCase();
82718
+ const concat = atStatement?.concatTokens().toUpperCase();
82719
+ const name = atStatement
82720
+ ?.findDirectExpression(abaplint.Expressions.FieldSub)
82721
+ ?.concatTokens()
82722
+ ?.toLowerCase();
82763
82723
  let suffix = `.get().${name}`;
82764
82724
  if (name === "table_line") {
82765
82725
  suffix = "";
82766
82726
  }
82767
- if (concat === null || concat === void 0 ? void 0 : concat.startsWith("AT NEW ")) {
82727
+ if (concat?.startsWith("AT NEW ")) {
82768
82728
  // eslint-disable-next-line max-len
82769
82729
  ret.appendString(`if (${previous} === undefined || abap.compare.eq(${previous}${suffix}, ${loopTarget}${suffix}) === false) {\n`);
82770
82730
  const body = node.findDirectStructure(abaplint.Structures.Body);
@@ -82773,7 +82733,7 @@ class AtTranspiler {
82773
82733
  }
82774
82734
  ret.appendString("}\n");
82775
82735
  }
82776
- else if (concat === null || concat === void 0 ? void 0 : concat.startsWith("AT END OF ")) {
82736
+ else if (concat?.startsWith("AT END OF ")) {
82777
82737
  const next = unique_identifier_1.UniqueIdentifier.get();
82778
82738
  ret.appendString(`let ${next} = undefined;\n`);
82779
82739
  const loop = new statements_1.LoopTranspiler({ injectFrom: tabix, skipInto: true });
@@ -82867,9 +82827,8 @@ const statements_1 = __webpack_require__(/*! ../statements */ "./node_modules/@a
82867
82827
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
82868
82828
  class CaseTranspiler {
82869
82829
  transpile(node, traversal) {
82870
- var _a;
82871
82830
  // does not use switch(), as it break;'s EXITs
82872
- const s = (_a = node.findDirectStatement(abaplint.Statements.Case)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(abaplint.Expressions.Source);
82831
+ const s = node.findDirectStatement(abaplint.Statements.Case)?.findDirectExpression(abaplint.Expressions.Source);
82873
82832
  if (s === undefined) {
82874
82833
  throw new Error("CASE, no Source found");
82875
82834
  }
@@ -82930,9 +82889,8 @@ const unique_identifier_1 = __webpack_require__(/*! ../unique_identifier */ "./n
82930
82889
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
82931
82890
  class CaseTypeTranspiler {
82932
82891
  transpile(node, traversal) {
82933
- var _a;
82934
82892
  // does not use switch(), as it break;'s EXITs
82935
- const s = (_a = node.findDirectStatement(abaplint.Statements.CaseType)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(abaplint.Expressions.Source);
82893
+ const s = node.findDirectStatement(abaplint.Statements.CaseType)?.findDirectExpression(abaplint.Expressions.Source);
82936
82894
  if (s === undefined) {
82937
82895
  throw new Error("CASE TYPE, no Source found");
82938
82896
  }
@@ -82954,7 +82912,7 @@ class CaseTypeTranspiler {
82954
82912
  ret.appendString("} else if (");
82955
82913
  }
82956
82914
  const cname = c.findDirectExpression(abaplint.Expressions.ClassName);
82957
- const lookup = traversal.lookupClassOrInterface(cname === null || cname === void 0 ? void 0 : cname.concatTokens(), cname === null || cname === void 0 ? void 0 : cname.getFirstToken());
82915
+ const lookup = traversal.lookupClassOrInterface(cname?.concatTokens(), cname?.getFirstToken());
82958
82916
  ret.appendString(u + ".get() instanceof " + lookup);
82959
82917
  ret.appendString(") {\n");
82960
82918
  ret.appendString(traversal.traverse(c.findDirectExpression(abaplint.Expressions.Target)).getCode() + ".set(" + u + ")\n");
@@ -82995,8 +82953,7 @@ const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abap
82995
82953
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
82996
82954
  class ClassDefinitionTranspiler {
82997
82955
  transpile(node, traversal) {
82998
- var _a;
82999
- const className = (_a = node.findFirstExpression(abaplint.Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
82956
+ const className = node.findFirstExpression(abaplint.Expressions.ClassName)?.concatTokens().toUpperCase();
83000
82957
  let found = false;
83001
82958
  if (className !== undefined) {
83002
82959
  for (const a of traversal.getCurrentObject().getABAPFiles()) {
@@ -83011,7 +82968,7 @@ class ClassDefinitionTranspiler {
83011
82968
  else {
83012
82969
  // its an abstract class with only abstract methods
83013
82970
  return new chunk_1.Chunk(`
83014
- class ${className === null || className === void 0 ? void 0 : className.toLowerCase()} {
82971
+ class ${className?.toLowerCase()} {
83015
82972
  static INTERNAL_TYPE = 'CLAS';
83016
82973
  static IMPLEMENTED_INTERFACES = [];
83017
82974
  static INTERNAL_NAME = 'ABSTRACT_CLASS_INTERNAL_NAME';
@@ -83064,10 +83021,9 @@ class ClassImplementationTranspiler {
83064
83021
  }
83065
83022
  ///////////////////////////////
83066
83023
  hasConstructor(node) {
83067
- var _a;
83068
83024
  for (const m of node.findAllStatements(abaplint.Statements.MethodImplementation)) {
83069
- const name = (_a = m.findFirstExpression(abaplint.Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr();
83070
- if ((name === null || name === void 0 ? void 0 : name.toUpperCase()) === "CONSTRUCTOR") {
83025
+ const name = m.findFirstExpression(abaplint.Expressions.MethodName)?.getFirstToken().getStr();
83026
+ if (name?.toUpperCase() === "CONSTRUCTOR") {
83071
83027
  return true;
83072
83028
  }
83073
83029
  }
@@ -83168,12 +83124,11 @@ class ClassImplementationTranspiler {
83168
83124
  return ret;
83169
83125
  }
83170
83126
  buildConstructor(node, traversal) {
83171
- var _a;
83172
83127
  if (node === undefined) {
83173
83128
  throw new Error("buildConstructor node undefined");
83174
83129
  }
83175
83130
  const scope = traversal.findCurrentScopeByToken(node.getFirstToken());
83176
- const token = (_a = node.findFirstExpression(abaplint.Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
83131
+ const token = node.findFirstExpression(abaplint.Expressions.ClassName)?.getFirstToken();
83177
83132
  if (token === undefined) {
83178
83133
  throw "buildConstructorTokenNotFound";
83179
83134
  }
@@ -83209,19 +83164,18 @@ const statements_1 = __webpack_require__(/*! ../statements */ "./node_modules/@a
83209
83164
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
83210
83165
  class ConstantsTranspiler {
83211
83166
  transpile(node, traversal) {
83212
- var _a, _b;
83213
83167
  const begin = node.findDirectStatement(abaplint.Statements.ConstantBegin);
83214
83168
  if (begin === undefined) {
83215
83169
  throw "ConstantsTranspilerBegin";
83216
83170
  }
83217
- const name = (_a = begin.findDirectExpression(abaplint.Expressions.DefinitionName)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr();
83171
+ const name = begin.findDirectExpression(abaplint.Expressions.DefinitionName)?.getFirstToken().getStr();
83218
83172
  if (name === undefined) {
83219
83173
  throw "ConstantsTranspilerName";
83220
83174
  }
83221
83175
  let ret = new statements_1.DataTranspiler().transpile(begin, traversal).getCode() + "\n";
83222
83176
  // todo: CONSTANTS BEGIN inside CONSTANTS BEGIN
83223
83177
  for (const c of node.findDirectStatements(abaplint.Statements.Constant)) {
83224
- const field = (_b = c.findDirectExpression(abaplint.Expressions.DefinitionName)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr();
83178
+ const field = c.findDirectExpression(abaplint.Expressions.DefinitionName)?.getFirstToken().getStr();
83225
83179
  if (field === undefined) {
83226
83180
  continue;
83227
83181
  }
@@ -83253,15 +83207,14 @@ const statements_1 = __webpack_require__(/*! ../statements */ "./node_modules/@a
83253
83207
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
83254
83208
  class DataTranspiler {
83255
83209
  transpile(node, traversal) {
83256
- var _a, _b;
83257
83210
  const begin = node.findDirectStatement(abaplint.Statements.DataBegin);
83258
83211
  if (begin === undefined) {
83259
83212
  return new chunk_1.Chunk("");
83260
83213
  }
83261
- const topName = (_a = begin.findDirectExpression(abaplint.Expressions.DefinitionName)) === null || _a === void 0 ? void 0 : _a.concatTokens().toLowerCase();
83214
+ const topName = begin.findDirectExpression(abaplint.Expressions.DefinitionName)?.concatTokens().toLowerCase();
83262
83215
  const chunk = new statements_1.DataTranspiler().transpile(begin, traversal);
83263
83216
  for (const d of node.findDirectStatements(abaplint.Statements.Data)) {
83264
- const subName = (_b = d.findFirstExpression(abaplint.Expressions.DefinitionName)) === null || _b === void 0 ? void 0 : _b.concatTokens().toLowerCase();
83217
+ const subName = d.findFirstExpression(abaplint.Expressions.DefinitionName)?.concatTokens().toLowerCase();
83265
83218
  if (subName && topName) {
83266
83219
  chunk.appendString(statements_1.DataTranspiler.buildValue(d, topName + ".get()." + subName, traversal));
83267
83220
  }
@@ -83352,12 +83305,11 @@ const transpile_types_1 = __webpack_require__(/*! ../transpile_types */ "./node_
83352
83305
  const unique_identifier_1 = __webpack_require__(/*! ../unique_identifier */ "./node_modules/@abaplint/transpiler/build/src/unique_identifier.js");
83353
83306
  class FunctionModuleTranspiler {
83354
83307
  transpile(node, traversal) {
83355
- var _a;
83356
83308
  let r = "";
83357
83309
  let name = "";
83358
83310
  for (const c of node.getChildren()) {
83359
83311
  if (c.get() instanceof abaplint.Statements.FunctionModule && c instanceof abaplint.Nodes.StatementNode) {
83360
- name = (_a = c.findDirectExpression(abaplint.Expressions.Field)) === null || _a === void 0 ? void 0 : _a.concatTokens().toLowerCase();
83312
+ name = c.findDirectExpression(abaplint.Expressions.Field)?.concatTokens().toLowerCase();
83361
83313
  if (name === undefined) {
83362
83314
  name = "FunctionModuleTranspilerNameNotFound";
83363
83315
  }
@@ -83377,7 +83329,6 @@ class FunctionModuleTranspiler {
83377
83329
  }
83378
83330
  //////////////////////
83379
83331
  findSignature(traversal, name, node) {
83380
- var _a, _b, _c;
83381
83332
  const group = traversal.getCurrentObject();
83382
83333
  if (group === undefined) {
83383
83334
  throw "FunctionModuleTranspilerGroupNotFound";
@@ -83399,11 +83350,11 @@ class FunctionModuleTranspiler {
83399
83350
  }
83400
83351
  // note: all directions are optional
83401
83352
  let name = p.name.toLowerCase();
83402
- if ((_b = (_a = traversal.options) === null || _a === void 0 ? void 0 : _a.keywords) === null || _b === void 0 ? void 0 : _b.some(a => a === name)) {
83353
+ if (traversal.options?.keywords?.some(a => a === name)) {
83403
83354
  name += "_";
83404
83355
  }
83405
83356
  ret += `let ${name} = INPUT.${direction}?.${name};\n`;
83406
- const type = (_c = scope === null || scope === void 0 ? void 0 : scope.findVariable(name)) === null || _c === void 0 ? void 0 : _c.getType();
83357
+ const type = scope?.findVariable(name)?.getType();
83407
83358
  if (type !== undefined && p.optional === true) {
83408
83359
  // todo, set DEFAULT value
83409
83360
  ret += `if (${name} === undefined) {
@@ -83481,14 +83432,13 @@ const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/
83481
83432
  const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
83482
83433
  class InterfaceTranspiler {
83483
83434
  transpile(node, traversal) {
83484
- var _a;
83485
83435
  let ret = "";
83486
83436
  let name;
83487
83437
  const def = traversal.getInterfaceDefinition(node.getFirstToken());
83488
83438
  for (const c of node.getChildren()) {
83489
83439
  if (c instanceof abaplint.Nodes.StatementNode && c.get() instanceof abaplint.Statements.Interface) {
83490
83440
  const scope = traversal.findCurrentScopeByToken(node.getFirstToken());
83491
- name = (_a = c.findDirectExpression(abaplint.Expressions.InterfaceName)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr().toLowerCase();
83441
+ name = c.findDirectExpression(abaplint.Expressions.InterfaceName)?.getFirstToken().getStr().toLowerCase();
83492
83442
  name = traversal_1.Traversal.escapeNamespace(name);
83493
83443
  ret += `class ${name} {\n`;
83494
83444
  ret += `static INTERNAL_TYPE = 'INTF';\n`;
@@ -83520,7 +83470,7 @@ class InterfaceTranspiler {
83520
83470
  return "";
83521
83471
  }
83522
83472
  const scope = traversal.findCurrentScopeByToken(node.getFirstToken());
83523
- const vars = scope === null || scope === void 0 ? void 0 : scope.getData().vars;
83473
+ const vars = scope?.getData().vars;
83524
83474
  if (vars === undefined || Object.keys(vars).length === 0) {
83525
83475
  return "";
83526
83476
  }
@@ -83534,14 +83484,14 @@ class InterfaceTranspiler {
83534
83484
  const interfaceName = traversal_1.Traversal.escapeNamespace(node.getFirstToken().getStr().toLowerCase());
83535
83485
  const name = interfaceName + "." + interfaceName + "$" + n.toLowerCase();
83536
83486
  ret += name + " = " + new transpile_types_1.TranspileTypes().toType(identifier.getType()) + ";\n";
83537
- const alias = idef === null || idef === void 0 ? void 0 : idef.getAliases().getAll().find(a => a.getName().toUpperCase() === n.toUpperCase());
83487
+ const alias = idef?.getAliases().getAll().find(a => a.getName().toUpperCase() === n.toUpperCase());
83538
83488
  if (alias) {
83539
83489
  // todo: this is an evil workaround, should be fixed in abaplint instead
83540
83490
  ret += interfaceName + "." + alias.getComponent().split("~")[0].toLowerCase() + "$" + n.toLowerCase() + " = " + name + ";\n";
83541
83491
  }
83542
83492
  const constantStatement = traversal.findStatementInFile(identifier.getStart());
83543
- const valExpression = constantStatement === null || constantStatement === void 0 ? void 0 : constantStatement.findFirstExpression(abaplint.Expressions.Value);
83544
- if ((valExpression === null || valExpression === void 0 ? void 0 : valExpression.getChildren()[1].get()) instanceof abaplint.Expressions.SimpleFieldChain) {
83493
+ const valExpression = constantStatement?.findFirstExpression(abaplint.Expressions.Value);
83494
+ if (valExpression?.getChildren()[1].get() instanceof abaplint.Expressions.SimpleFieldChain) {
83545
83495
  const s = new expressions_1.FieldChainTranspiler().transpile(valExpression.getChildren()[1], traversal, false).getCode();
83546
83496
  const e = expressions_1.ConstantTranspiler.escape(s);
83547
83497
  ret += name + ".set(" + e + ");\n";
@@ -83576,7 +83526,6 @@ const statements_1 = __webpack_require__(/*! ../statements */ "./node_modules/@a
83576
83526
  const at_1 = __webpack_require__(/*! ./at */ "./node_modules/@abaplint/transpiler/build/src/structures/at.js");
83577
83527
  class LoopTranspiler {
83578
83528
  transpile(node, traversal) {
83579
- var _a;
83580
83529
  const ret = new chunk_1.Chunk();
83581
83530
  let pre = "";
83582
83531
  let atFirst = undefined;
@@ -83586,7 +83535,7 @@ class LoopTranspiler {
83586
83535
  let tabix = "";
83587
83536
  let loopTarget = "";
83588
83537
  let hasAt = false;
83589
- for (const n of ((_a = node.findDirectStructure(abaplint.Structures.Body)) === null || _a === void 0 ? void 0 : _a.findDirectStructures(abaplint.Structures.Normal)) || []) {
83538
+ for (const n of node.findDirectStructure(abaplint.Structures.Body)?.findDirectStructures(abaplint.Structures.Normal) || []) {
83590
83539
  if (n.findDirectStructure(abaplint.Structures.At) !== undefined) {
83591
83540
  hasAt = true;
83592
83541
  break;
@@ -83679,14 +83628,13 @@ const unique_identifier_1 = __webpack_require__(/*! ../unique_identifier */ "./n
83679
83628
  const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/@abaplint/transpiler/build/src/expressions/index.js");
83680
83629
  class SelectTranspiler {
83681
83630
  transpile(node, traversal) {
83682
- var _a, _b;
83683
83631
  const ret = new chunk_1.Chunk();
83684
83632
  const selectStatement = node.findFirstStatement(abaplint.Statements.SelectLoop);
83685
83633
  if (selectStatement === undefined) {
83686
83634
  throw "Structure, select loop not found";
83687
83635
  }
83688
83636
  const concat = selectStatement.concatTokens().toUpperCase();
83689
- const from = (_a = selectStatement.findFirstExpression(abaplint.Expressions.SQLFromSource)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
83637
+ const from = selectStatement.findFirstExpression(abaplint.Expressions.SQLFromSource)?.concatTokens().toUpperCase();
83690
83638
  const intoName = new expressions_1.SQLTargetTranspiler().transpile(selectStatement.findFirstExpression(abaplint.Expressions.SQLTarget), traversal).getCode();
83691
83639
  // note: this implementation SELECTs everything into memory, which might be bad, and sometimes not correct
83692
83640
  const targetName = unique_identifier_1.UniqueIdentifier.get();
@@ -83694,7 +83642,7 @@ class SelectTranspiler {
83694
83642
  ret.appendString(`let ${targetName} = new abap.types.Table(abap.DDIC["${from}"].type);\n`);
83695
83643
  ret.appendChunk(new select_1.SelectTranspiler().transpile(selectStatement, traversal, targetName));
83696
83644
  // todo: optimize, it should do real streaming?
83697
- const packageSize = (_b = node.findFirstExpression(abaplint.Expressions.SelectLoop)) === null || _b === void 0 ? void 0 : _b.findExpressionAfterToken("SIZE");
83645
+ const packageSize = node.findFirstExpression(abaplint.Expressions.SelectLoop)?.findExpressionAfterToken("SIZE");
83698
83646
  if (packageSize) {
83699
83647
  const getSize = new expressions_1.SQLSourceTranspiler().transpile(packageSize, traversal).getCode() + ".get()";
83700
83648
  ret.appendString(`if (${targetName}.array().length > ${getSize}) {
@@ -83781,7 +83729,7 @@ class TryTranspiler {
83781
83729
  const catchNames = catchStatement.findDirectExpressions(abaplint.Expressions.ClassName).map(e => traversal.lookupClassOrInterface(e.concatTokens(), e.getFirstToken()));
83782
83730
  ret += first ? "" : " else ";
83783
83731
  first = false;
83784
- ret += "if (" + (catchNames === null || catchNames === void 0 ? void 0 : catchNames.map(n => "(" + n + " && e instanceof " + n + ")").join(" || ")) + ") {\n";
83732
+ ret += "if (" + catchNames?.map(n => "(" + n + " && e instanceof " + n + ")").join(" || ") + ") {\n";
83785
83733
  const intoNode = catchStatement.findExpressionAfterToken("INTO");
83786
83734
  if (intoNode) {
83787
83735
  ret += traversal.traverse(intoNode).getCode() + ".set(e);\n";
@@ -83916,14 +83864,13 @@ class TranspileTypes {
83916
83864
  return pre + t.getName().toLowerCase() + " = " + code + ";\n";
83917
83865
  }
83918
83866
  toType(type) {
83919
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
83920
83867
  let resolved = "";
83921
83868
  let extra = "";
83922
83869
  if (type instanceof abaplint.BasicTypes.ObjectReferenceType
83923
83870
  || type instanceof abaplint.BasicTypes.GenericObjectReferenceType) {
83924
83871
  resolved = "ABAPObject";
83925
- extra = "{qualifiedName: " + JSON.stringify((_a = type.getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toUpperCase()) +
83926
- ", RTTIName: " + JSON.stringify((_b = type.getRTTIName()) === null || _b === void 0 ? void 0 : _b.toUpperCase()) + "}";
83872
+ extra = "{qualifiedName: " + JSON.stringify(type.getQualifiedName()?.toUpperCase()) +
83873
+ ", RTTIName: " + JSON.stringify(type.getRTTIName()?.toUpperCase()) + "}";
83927
83874
  }
83928
83875
  else if (type instanceof abaplint.BasicTypes.TableType) {
83929
83876
  resolved = "Table";
@@ -83937,37 +83884,37 @@ class TranspileTypes {
83937
83884
  else if (type instanceof abaplint.BasicTypes.IntegerType) {
83938
83885
  resolved = "Integer";
83939
83886
  if (type.getQualifiedName() !== undefined) {
83940
- extra = "{qualifiedName: \"" + ((_c = type.getQualifiedName()) === null || _c === void 0 ? void 0 : _c.toUpperCase()) + "\"}";
83887
+ extra = "{qualifiedName: \"" + type.getQualifiedName()?.toUpperCase() + "\"}";
83941
83888
  }
83942
83889
  }
83943
83890
  else if (type instanceof abaplint.BasicTypes.Integer8Type) {
83944
83891
  resolved = "Integer8";
83945
83892
  if (type.getQualifiedName() !== undefined) {
83946
- extra = "{qualifiedName: \"" + ((_d = type.getQualifiedName()) === null || _d === void 0 ? void 0 : _d.toUpperCase()) + "\"}";
83893
+ extra = "{qualifiedName: \"" + type.getQualifiedName()?.toUpperCase() + "\"}";
83947
83894
  }
83948
83895
  }
83949
83896
  else if (type instanceof abaplint.BasicTypes.StringType) {
83950
83897
  resolved = "String";
83951
83898
  if (type.getQualifiedName() !== undefined) {
83952
- extra = "{qualifiedName: \"" + ((_e = type.getQualifiedName()) === null || _e === void 0 ? void 0 : _e.toUpperCase()) + "\"}";
83899
+ extra = "{qualifiedName: \"" + type.getQualifiedName()?.toUpperCase() + "\"}";
83953
83900
  }
83954
83901
  }
83955
83902
  else if (type instanceof abaplint.BasicTypes.UTCLongType) {
83956
83903
  resolved = "UTCLong";
83957
83904
  if (type.getQualifiedName() !== undefined) {
83958
- extra = "{qualifiedName: \"" + ((_f = type.getQualifiedName()) === null || _f === void 0 ? void 0 : _f.toUpperCase()) + "\"}";
83905
+ extra = "{qualifiedName: \"" + type.getQualifiedName()?.toUpperCase() + "\"}";
83959
83906
  }
83960
83907
  }
83961
83908
  else if (type instanceof abaplint.BasicTypes.DateType) {
83962
83909
  resolved = "Date";
83963
83910
  if (type.getQualifiedName() !== undefined) {
83964
- extra = "{qualifiedName: \"" + ((_g = type.getQualifiedName()) === null || _g === void 0 ? void 0 : _g.toUpperCase()) + "\"}";
83911
+ extra = "{qualifiedName: \"" + type.getQualifiedName()?.toUpperCase() + "\"}";
83965
83912
  }
83966
83913
  }
83967
83914
  else if (type instanceof abaplint.BasicTypes.TimeType) {
83968
83915
  resolved = "Time";
83969
83916
  if (type.getQualifiedName() !== undefined) {
83970
- extra = "{qualifiedName: \"" + ((_h = type.getQualifiedName()) === null || _h === void 0 ? void 0 : _h.toUpperCase()) + "\"}";
83917
+ extra = "{qualifiedName: \"" + type.getQualifiedName()?.toUpperCase() + "\"}";
83971
83918
  }
83972
83919
  }
83973
83920
  else if (type instanceof abaplint.BasicTypes.DataReference) {
@@ -84052,7 +83999,7 @@ class TranspileTypes {
84052
83999
  else if (type instanceof abaplint.BasicTypes.XStringType) {
84053
84000
  resolved = "XString";
84054
84001
  if (type.getQualifiedName() !== undefined) {
84055
- extra = "{qualifiedName: \"" + ((_j = type.getQualifiedName()) === null || _j === void 0 ? void 0 : _j.toUpperCase()) + "\"}";
84002
+ extra = "{qualifiedName: \"" + type.getQualifiedName()?.toUpperCase() + "\"}";
84056
84003
  }
84057
84004
  }
84058
84005
  else if (type instanceof abaplint.BasicTypes.XSequenceType
@@ -84069,13 +84016,13 @@ class TranspileTypes {
84069
84016
  else if (type instanceof abaplint.BasicTypes.FloatType) {
84070
84017
  resolved = "Float";
84071
84018
  if (type.getQualifiedName() !== undefined) {
84072
- extra = "{qualifiedName: \"" + ((_k = type.getQualifiedName()) === null || _k === void 0 ? void 0 : _k.toUpperCase()) + "\"}";
84019
+ extra = "{qualifiedName: \"" + type.getQualifiedName()?.toUpperCase() + "\"}";
84073
84020
  }
84074
84021
  }
84075
84022
  else if (type instanceof abaplint.BasicTypes.FloatingPointType) {
84076
84023
  resolved = "Float";
84077
84024
  if (type.getQualifiedName() !== undefined) {
84078
- extra = "{qualifiedName: \"" + ((_l = type.getQualifiedName()) === null || _l === void 0 ? void 0 : _l.toUpperCase()) + "\"}";
84025
+ extra = "{qualifiedName: \"" + type.getQualifiedName()?.toUpperCase() + "\"}";
84079
84026
  }
84080
84027
  }
84081
84028
  else if (type instanceof abaplint.BasicTypes.DecFloat34Type) {
@@ -84125,7 +84072,7 @@ class Traversal {
84125
84072
  this.options = options;
84126
84073
  }
84127
84074
  static escapeNamespace(name) {
84128
- return name === null || name === void 0 ? void 0 : name.replace(/\//g, "$");
84075
+ return name?.replace(/\//g, "$");
84129
84076
  }
84130
84077
  getCurrentObject() {
84131
84078
  return this.obj;
@@ -84190,7 +84137,7 @@ class Traversal {
84190
84137
  let scope = this.findCurrentScopeByToken(token);
84191
84138
  while (scope !== undefined) {
84192
84139
  if (scope.getIdentifier().stype === abaplint.ScopeType.Interface) {
84193
- return scope.findInterfaceDefinition(scope === null || scope === void 0 ? void 0 : scope.getIdentifier().sname);
84140
+ return scope.findInterfaceDefinition(scope?.getIdentifier().sname);
84194
84141
  }
84195
84142
  scope = scope.getParent();
84196
84143
  }
@@ -84201,7 +84148,7 @@ class Traversal {
84201
84148
  while (scope !== undefined) {
84202
84149
  if (scope.getIdentifier().stype === abaplint.ScopeType.ClassImplementation
84203
84150
  || scope.getIdentifier().stype === abaplint.ScopeType.ClassDefinition) {
84204
- return scope.findClassDefinition(scope === null || scope === void 0 ? void 0 : scope.getIdentifier().sname);
84151
+ return scope.findClassDefinition(scope?.getIdentifier().sname);
84205
84152
  }
84206
84153
  scope = scope.getParent();
84207
84154
  }
@@ -84308,18 +84255,17 @@ class Traversal {
84308
84255
  }
84309
84256
  }
84310
84257
  buildAttributes(def, scope, prefix = "") {
84311
- var _a, _b;
84312
84258
  const attr = [];
84313
84259
  if (def === undefined) {
84314
84260
  return attr;
84315
84261
  }
84316
- for (const a of ((_a = def.getAttributes()) === null || _a === void 0 ? void 0 : _a.getAll()) || []) {
84262
+ for (const a of def.getAttributes()?.getAll() || []) {
84317
84263
  const type = new transpile_types_1.TranspileTypes().toType(a.getType());
84318
84264
  const runtime = this.mapVisibility(a.getVisibility());
84319
84265
  const isClass = a.getMeta().includes("static" /* abaplint.IdentifierMeta.Static */) ? "X" : " ";
84320
84266
  attr.push(`"${prefix + a.getName().toUpperCase()}": {"type": () => {return ${type};}, "visibility": "${runtime}", "is_constant": " ", "is_class": "${isClass}"}`);
84321
84267
  }
84322
- for (const a of ((_b = def.getAttributes()) === null || _b === void 0 ? void 0 : _b.getConstants()) || []) {
84268
+ for (const a of def.getAttributes()?.getConstants() || []) {
84323
84269
  const type = new transpile_types_1.TranspileTypes().toType(a.getType());
84324
84270
  let runtime = "";
84325
84271
  switch (a.getVisibility()) {
@@ -84355,7 +84301,7 @@ class Traversal {
84355
84301
  }
84356
84302
  isSQLConversion(token) {
84357
84303
  const scope = this.findCurrentScopeByToken(token);
84358
- for (const s of (scope === null || scope === void 0 ? void 0 : scope.getData().sqlConversion) || []) {
84304
+ for (const s of scope?.getData().sqlConversion || []) {
84359
84305
  if (s.token.getStart().equals(token.getStart())) {
84360
84306
  return s.fieldName;
84361
84307
  }
@@ -84363,7 +84309,6 @@ class Traversal {
84363
84309
  return undefined;
84364
84310
  }
84365
84311
  findMethodReference(token, scope) {
84366
- var _a, _b;
84367
84312
  let candidate = undefined;
84368
84313
  if (scope === undefined) {
84369
84314
  return undefined;
@@ -84373,7 +84318,7 @@ class Traversal {
84373
84318
  && r.position.getStart().equals(token.getStart())
84374
84319
  && r.resolved instanceof abaplint.Types.MethodDefinition) {
84375
84320
  let name = r.resolved.getName();
84376
- if (((_a = r.extra) === null || _a === void 0 ? void 0 : _a.ooName) && ((_b = r.extra) === null || _b === void 0 ? void 0 : _b.ooType) === "INTF") {
84321
+ if (r.extra?.ooName && r.extra?.ooType === "INTF") {
84377
84322
  name = r.extra.ooName + "$" + name;
84378
84323
  }
84379
84324
  candidate = { def: r.resolved, name };
@@ -84407,13 +84352,13 @@ class Traversal {
84407
84352
  }
84408
84353
  isTypePool(token) {
84409
84354
  const ref = this.findReadOrWriteReference(token);
84410
- if (ref === null || ref === void 0 ? void 0 : ref.getFilename().endsWith(".type.abap")) {
84355
+ if (ref?.getFilename().endsWith(".type.abap")) {
84411
84356
  const file = this.reg.getFileByName(ref.getFilename());
84412
84357
  if (file === undefined) {
84413
84358
  return undefined;
84414
84359
  }
84415
84360
  const obj = this.reg.findObjectForFile(file);
84416
- return obj === null || obj === void 0 ? void 0 : obj.getName();
84361
+ return obj?.getName();
84417
84362
  }
84418
84363
  return undefined;
84419
84364
  }
@@ -84426,8 +84371,8 @@ class Traversal {
84426
84371
  // local
84427
84372
  if (ref.getFilename() === this.getFilename()) {
84428
84373
  const scope = this.findCurrentScopeByToken(ref.getToken());
84429
- if ((scope === null || scope === void 0 ? void 0 : scope.getIdentifier().stype) === abaplint.ScopeType.Interface) {
84430
- return scope === null || scope === void 0 ? void 0 : scope.getIdentifier().sname;
84374
+ if (scope?.getIdentifier().stype === abaplint.ScopeType.Interface) {
84375
+ return scope?.getIdentifier().sname;
84431
84376
  }
84432
84377
  }
84433
84378
  // global
@@ -84462,7 +84407,6 @@ class Traversal {
84462
84407
  return undefined;
84463
84408
  }
84464
84409
  buildConstructorContents(scope, def) {
84465
- var _a, _b, _c;
84466
84410
  let ret = "";
84467
84411
  if (def.getSuperClass() !== undefined || def.getName().toUpperCase() === "CX_ROOT") {
84468
84412
  ret += "super();\n";
@@ -84470,7 +84414,7 @@ class Traversal {
84470
84414
  const cName = Traversal.escapeNamespace(def.getName().toLowerCase());
84471
84415
  ret += "this.me = new abap.types.ABAPObject();\n";
84472
84416
  ret += "this.me.set(this);\n";
84473
- for (const a of ((_a = def.getAttributes()) === null || _a === void 0 ? void 0 : _a.getAll()) || []) {
84417
+ for (const a of def.getAttributes()?.getAll() || []) {
84474
84418
  const escaped = Traversal.escapeNamespace(a.getName().toLowerCase());
84475
84419
  if (a.getMeta().includes("static" /* abaplint.IdentifierMeta.Static */) === true) {
84476
84420
  ret += "this." + escaped + " = " + cName + "." + escaped + ";\n";
@@ -84486,20 +84430,20 @@ class Traversal {
84486
84430
  ret += this.aliasesFromInterfaces(i.name, scope, cName);
84487
84431
  }
84488
84432
  // handle aliases after initialization of carrier variables
84489
- for (const a of ((_b = def.getAliases()) === null || _b === void 0 ? void 0 : _b.getAll()) || []) {
84433
+ for (const a of def.getAliases()?.getAll() || []) {
84490
84434
  ret += "this." + a.getName().toLowerCase() + " = this." + Traversal.escapeNamespace(a.getComponent().replace("~", "$").toLowerCase()) + ";\n";
84491
84435
  }
84492
84436
  // constants can be accessed both statically and via reference
84493
- for (const c of ((_c = def.getAttributes()) === null || _c === void 0 ? void 0 : _c.getConstants()) || []) {
84437
+ for (const c of def.getAttributes()?.getConstants() || []) {
84494
84438
  ret += "this." + Traversal.escapeNamespace(c.getName().toLowerCase()) + " = " + cName + "." + Traversal.escapeNamespace(c.getName().toLowerCase()) + ";\n";
84495
84439
  }
84496
84440
  return ret;
84497
84441
  }
84498
84442
  findInterfaceDefinition(name, scope) {
84499
- let intf = scope === null || scope === void 0 ? void 0 : scope.findInterfaceDefinition(name);
84443
+ let intf = scope?.findInterfaceDefinition(name);
84500
84444
  if (intf === undefined) {
84501
84445
  const iglobal = this.reg.getObject("INTF", name);
84502
- intf = iglobal === null || iglobal === void 0 ? void 0 : iglobal.getDefinition();
84446
+ intf = iglobal?.getDefinition();
84503
84447
  }
84504
84448
  return intf;
84505
84449
  }
@@ -84514,24 +84458,24 @@ class Traversal {
84514
84458
  let clas = scope.findClassDefinition(name);
84515
84459
  if (clas === undefined) {
84516
84460
  const iglobal = this.reg.getObject("CLAS", name);
84517
- clas = iglobal === null || iglobal === void 0 ? void 0 : iglobal.getDefinition();
84461
+ clas = iglobal?.getDefinition();
84518
84462
  }
84519
84463
  return clas;
84520
84464
  }
84521
84465
  dataFromInterfaces(name, scope, cname) {
84522
84466
  let ret = "";
84523
84467
  const intf = this.findInterfaceDefinition(name, scope);
84524
- for (const a of (intf === null || intf === void 0 ? void 0 : intf.getAttributes().getConstants()) || []) {
84468
+ for (const a of intf?.getAttributes().getConstants() || []) {
84525
84469
  const fname = Traversal.escapeNamespace(a.getName().toLowerCase());
84526
- const iname = Traversal.escapeNamespace(intf === null || intf === void 0 ? void 0 : intf.getName().toLowerCase());
84527
- if ((intf === null || intf === void 0 ? void 0 : intf.isGlobal()) === true) {
84528
- ret += "this." + iname + "$" + fname + " = abap.Classes['" + (intf === null || intf === void 0 ? void 0 : intf.getName().toUpperCase()) + "']." + iname + "$" + fname + ";\n";
84470
+ const iname = Traversal.escapeNamespace(intf?.getName().toLowerCase());
84471
+ if (intf?.isGlobal() === true) {
84472
+ ret += "this." + iname + "$" + fname + " = abap.Classes['" + intf?.getName().toUpperCase() + "']." + iname + "$" + fname + ";\n";
84529
84473
  }
84530
84474
  else {
84531
84475
  ret += "this." + iname + "$" + fname + " = " + iname + "." + iname + "$" + fname + ";\n";
84532
84476
  }
84533
84477
  }
84534
- for (const a of (intf === null || intf === void 0 ? void 0 : intf.getAttributes().getAll()) || []) {
84478
+ for (const a of intf?.getAttributes().getAll() || []) {
84535
84479
  const n = Traversal.escapeNamespace(name.toLowerCase()) + "$" + a.getName().toLowerCase();
84536
84480
  // note: interface inheritenace and super inheritance might be strange,
84537
84481
  if (a.getMeta().includes("static" /* abaplint.IdentifierMeta.Static */) === true) {
@@ -84541,7 +84485,7 @@ class Traversal {
84541
84485
  ret += "if (this." + n + " === undefined) this." + n + " = " + new transpile_types_1.TranspileTypes().toType(a.getType()) + ";\n";
84542
84486
  }
84543
84487
  }
84544
- for (const i of (intf === null || intf === void 0 ? void 0 : intf.getImplementing()) || []) {
84488
+ for (const i of intf?.getImplementing() || []) {
84545
84489
  ret += this.dataFromInterfaces(i.name, scope, cname);
84546
84490
  }
84547
84491
  return ret;
@@ -84549,19 +84493,18 @@ class Traversal {
84549
84493
  aliasesFromInterfaces(name, scope, cname) {
84550
84494
  let ret = "";
84551
84495
  const intf = this.findInterfaceDefinition(name, scope);
84552
- for (const a of (intf === null || intf === void 0 ? void 0 : intf.getAliases().getAll()) || []) {
84553
- const iname = Traversal.escapeNamespace(intf === null || intf === void 0 ? void 0 : intf.getName().toLowerCase());
84496
+ for (const a of intf?.getAliases().getAll() || []) {
84497
+ const iname = Traversal.escapeNamespace(intf?.getName().toLowerCase());
84554
84498
  const aname = Traversal.escapeNamespace(a.getName().toLowerCase());
84555
84499
  const cname = Traversal.escapeNamespace(a.getComponent().toLowerCase().replace("~", "$"));
84556
84500
  ret += "this." + iname + "$" + aname + " = this." + cname + ";\n";
84557
84501
  }
84558
- for (const i of (intf === null || intf === void 0 ? void 0 : intf.getImplementing()) || []) {
84502
+ for (const i of intf?.getImplementing() || []) {
84559
84503
  ret += this.aliasesFromInterfaces(i.name, scope, cname);
84560
84504
  }
84561
84505
  return ret;
84562
84506
  }
84563
84507
  determineType(node, scope) {
84564
- var _a, _b, _c;
84565
84508
  if (scope === undefined) {
84566
84509
  return undefined;
84567
84510
  }
@@ -84572,7 +84515,7 @@ class Traversal {
84572
84515
  let context = undefined;
84573
84516
  for (const c of found.getChildren()) {
84574
84517
  if (context === undefined) {
84575
- context = (_a = scope.findVariable(c.getFirstToken().getStr())) === null || _a === void 0 ? void 0 : _a.getType();
84518
+ context = scope.findVariable(c.getFirstToken().getStr())?.getType();
84576
84519
  }
84577
84520
  else if (c.get() instanceof abaplint.Expressions.ComponentName
84578
84521
  && context instanceof abaplint.BasicTypes.StructureType) {
@@ -84586,10 +84529,10 @@ class Traversal {
84586
84529
  if (concat.includes("~")) {
84587
84530
  const [iname, aname] = concat.split("~");
84588
84531
  const intf = this.findInterfaceDefinition(iname, scope);
84589
- context = (_b = intf === null || intf === void 0 ? void 0 : intf.getAttributes().findByName(aname)) === null || _b === void 0 ? void 0 : _b.getType();
84532
+ context = intf?.getAttributes().findByName(aname)?.getType();
84590
84533
  }
84591
84534
  else {
84592
- context = (_c = id.getAttributes().findByName(concat)) === null || _c === void 0 ? void 0 : _c.getType();
84535
+ context = id.getAttributes().findByName(concat)?.getType();
84593
84536
  }
84594
84537
  }
84595
84538
  }
@@ -84676,14 +84619,13 @@ class Traversal {
84676
84619
  return ret;
84677
84620
  }
84678
84621
  buildInternalName(name, def) {
84679
- var _a, _b;
84680
84622
  if (def) {
84681
84623
  if (def.isGlobal() === false) {
84682
84624
  const prefix = this.buildPrefix();
84683
- return `${prefix}${(_a = def === null || def === void 0 ? void 0 : def.getName()) === null || _a === void 0 ? void 0 : _a.toUpperCase()}`;
84625
+ return `${prefix}${def?.getName()?.toUpperCase()}`;
84684
84626
  }
84685
84627
  else {
84686
- return (_b = def === null || def === void 0 ? void 0 : def.getName()) === null || _b === void 0 ? void 0 : _b.toUpperCase();
84628
+ return def?.getName()?.toUpperCase();
84687
84629
  }
84688
84630
  }
84689
84631
  // assume global
@@ -84697,9 +84639,9 @@ class Traversal {
84697
84639
  return "abap.Classes[" + name + ".trimEnd()]";
84698
84640
  }
84699
84641
  const scope = this.findCurrentScopeByToken(token);
84700
- let def = scope === null || scope === void 0 ? void 0 : scope.findClassDefinition(name);
84642
+ let def = scope?.findClassDefinition(name);
84701
84643
  if (def === undefined) {
84702
- def = scope === null || scope === void 0 ? void 0 : scope.findInterfaceDefinition(name);
84644
+ def = scope?.findInterfaceDefinition(name);
84703
84645
  }
84704
84646
  const internalName = this.buildInternalName(name, def);
84705
84647
  return "abap.Classes['" + internalName + "']";
@@ -85179,11 +85121,10 @@ run().then(() => {
85179
85121
  // class constructors might make early use of eg. constants from interfaces
85180
85122
  // sub classes will import() super classes and trigger a class constructor of the super
85181
85123
  hasClassConstructor(reg, clas) {
85182
- var _a, _b;
85183
- if (((_a = clas.getDefinition()) === null || _a === void 0 ? void 0 : _a.getMethodDefinitions().getByName("CLASS_CONSTRUCTOR")) !== undefined) {
85124
+ if (clas.getDefinition()?.getMethodDefinitions().getByName("CLASS_CONSTRUCTOR") !== undefined) {
85184
85125
  return true;
85185
85126
  }
85186
- const sup = (_b = clas.getDefinition()) === null || _b === void 0 ? void 0 : _b.getSuperClass();
85127
+ const sup = clas.getDefinition()?.getSuperClass();
85187
85128
  if (sup !== undefined) {
85188
85129
  const superClass = reg.getObject("CLAS", sup);
85189
85130
  if (superClass) {
@@ -85319,15 +85260,14 @@ class Validation {
85319
85260
  this.options = options;
85320
85261
  }
85321
85262
  run(reg) {
85322
- var _a, _b, _c;
85323
- if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.ignoreSyntaxCheck) === true) {
85263
+ if (this.options?.ignoreSyntaxCheck === true) {
85324
85264
  exports.config.rules.check_syntax = false;
85325
85265
  }
85326
85266
  else {
85327
85267
  exports.config.rules.check_syntax = true;
85328
85268
  }
85329
85269
  exports.config.rules.forbidden_identifier.check = ["^unique\\d+$"];
85330
- if (((_b = this.options) === null || _b === void 0 ? void 0 : _b.keywords) === undefined) {
85270
+ if (this.options?.keywords === undefined) {
85331
85271
  for (const d of keywords_1.defaultKeywords) {
85332
85272
  const add = "^" + d + "$";
85333
85273
  exports.config.rules["forbidden_identifier"]["check"].push(add);
@@ -85339,7 +85279,7 @@ class Validation {
85339
85279
  exports.config.rules["forbidden_identifier"]["check"].push(add);
85340
85280
  }
85341
85281
  }
85342
- if (((_c = this.options) === null || _c === void 0 ? void 0 : _c.unknownTypes) === types_1.UnknownTypesEnum.runtimeError) {
85282
+ if (this.options?.unknownTypes === types_1.UnknownTypesEnum.runtimeError) {
85343
85283
  // this is not a constant, just a regex that happens to not match anything
85344
85284
  exports.config.syntax.errorNamespace = "VOID_EVERYTHING";
85345
85285
  }