@abaplint/transpiler-cli 2.10.59 → 2.10.60

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 +30 -18
  2. package/package.json +4 -4
package/build/bundle.js CHANGED
@@ -21384,6 +21384,19 @@ class CurrentScope {
21384
21384
  }
21385
21385
  return false;
21386
21386
  }
21387
+ isAnyOO() {
21388
+ let curr = this.current;
21389
+ while (curr !== undefined) {
21390
+ const stype = curr.getIdentifier().stype;
21391
+ if (stype === _scope_type_1.ScopeType.ClassDefinition
21392
+ || stype === _scope_type_1.ScopeType.ClassImplementation
21393
+ || stype === _scope_type_1.ScopeType.Interface) {
21394
+ return true;
21395
+ }
21396
+ curr = curr.getParent();
21397
+ }
21398
+ return false;
21399
+ }
21387
21400
  isGlobalOO() {
21388
21401
  return this.parentObj.getType() === "INTF" || this.parentObj.getType() === "CLAS";
21389
21402
  }
@@ -22802,7 +22815,7 @@ class BasicTypes {
22802
22815
  if (type === undefined) {
22803
22816
  type = (_a = this.input.scope.getDDIC().lookupNoVoid(name)) === null || _a === void 0 ? void 0 : _a.type;
22804
22817
  }
22805
- if (type === undefined && this.input.scope.isOO() === false && this.input.scope.getDDIC().inErrorNamespace(name) === false) {
22818
+ if (type === undefined && this.input.scope.isAnyOO() === false && this.input.scope.getDDIC().inErrorNamespace(name) === false) {
22806
22819
  this.input.scope.addReference(chain.getChildren()[0].getFirstToken(), undefined, _reference_1.ReferenceType.VoidType, this.input.filename);
22807
22820
  return new Types.VoidType(name);
22808
22821
  }
@@ -24373,7 +24386,6 @@ class DataDefinition {
24373
24386
  }
24374
24387
  }
24375
24388
  if (name) {
24376
- console.dir("undef");
24377
24389
  return new _typed_identifier_1.TypedIdentifier(name.getFirstToken(), input.filename, new basic_1.UnknownType("DataDefinition, fallback"));
24378
24390
  }
24379
24391
  return undefined;
@@ -53139,7 +53151,7 @@ class Registry {
53139
53151
  }
53140
53152
  static abaplintVersion() {
53141
53153
  // magic, see build script "version.sh"
53142
- return "2.113.125";
53154
+ return "2.113.126";
53143
53155
  }
53144
53156
  getDDICReferences() {
53145
53157
  return this.ddicReferences;
@@ -75861,7 +75873,7 @@ class XMLConsistency {
75861
75873
  issues.push(issue_1.Issue.atRow(file, 1, "Class matching XML name not found in ABAP file", this.getMetadata().key, this.conf.severity));
75862
75874
  }
75863
75875
  }
75864
- if (obj instanceof Objects.Interface) {
75876
+ else if (obj instanceof Objects.Interface) {
75865
75877
  const name = obj.getNameFromXML();
75866
75878
  if (name === undefined) {
75867
75879
  issues.push(issue_1.Issue.atRow(file, 1, "Name undefined in XML", this.getMetadata().key, this.conf.severity));
@@ -81073,8 +81085,8 @@ class Transpiler {
81073
81085
  objects: [],
81074
81086
  unitTestScript: new unit_test_1.UnitTest().unitTestScript(reg, this.options?.skip),
81075
81087
  unitTestScriptOpen: new unit_test_1.UnitTest().unitTestScriptOpen(reg, this.options?.skip),
81076
- initializationScript: new initialization_1.Initialization().script(reg, dbSetup, this.options?.extraSetup),
81077
- initializationScript2: new initialization_1.Initialization().script(reg, dbSetup, this.options?.extraSetup, true),
81088
+ initializationScript: new initialization_1.Initialization().script(reg, dbSetup, this.options),
81089
+ initializationScript2: new initialization_1.Initialization().script(reg, dbSetup, this.options, true),
81078
81090
  databaseSetup: dbSetup,
81079
81091
  reg: reg,
81080
81092
  };
@@ -81155,7 +81167,7 @@ function escapeNamespaceFilename(filename) {
81155
81167
  return filename.replace(/\//g, "%23");
81156
81168
  }
81157
81169
  class Initialization {
81158
- script(reg, dbSetup, extraSetup, useImport) {
81170
+ script(reg, dbSetup, options, useImport) {
81159
81171
  let ret = "";
81160
81172
  if (useImport === true) {
81161
81173
  ret = `/* eslint-disable import/newline-after-import */
@@ -81166,7 +81178,7 @@ import "./_top.mjs";\n`;
81166
81178
  import runtime from "@abaplint/runtime";
81167
81179
  globalThis.abap = new runtime.ABAP();\n`;
81168
81180
  }
81169
- ret += `${this.buildImports(reg, useImport)}
81181
+ ret += `${this.buildImports(reg, useImport, options)}
81170
81182
 
81171
81183
  export async function initializeABAP() {\n`;
81172
81184
  ret += ` const sqlite = [];\n`;
@@ -81189,17 +81201,17 @@ export async function initializeABAP() {\n`;
81189
81201
  ret += ` insert.push(\`${i}\`);\n`;
81190
81202
  }
81191
81203
  ret += `\n`;
81192
- if (extraSetup === undefined || extraSetup === "") {
81204
+ if (options?.extraSetup === undefined || options?.extraSetup === "") {
81193
81205
  ret += `// no setup logic specified in config\n`;
81194
81206
  }
81195
81207
  else {
81196
- ret += ` const {setup} = await import("${extraSetup}");\n` +
81208
+ ret += ` const {setup} = await import("${options?.extraSetup}");\n` +
81197
81209
  ` await setup(globalThis.abap, schemas, insert);\n`;
81198
81210
  }
81199
81211
  ret += `}`;
81200
81212
  return ret;
81201
81213
  }
81202
- buildImports(reg, useImport) {
81214
+ buildImports(reg, useImport, options) {
81203
81215
  // note: ES modules are hoised, so use the dynamic import(), due to setting of globalThis.abap
81204
81216
  // some sorting required: eg. a class constructor using constant from interface
81205
81217
  const list = [];
@@ -81238,7 +81250,7 @@ export async function initializeABAP() {\n`;
81238
81250
  }
81239
81251
  else if (obj instanceof abaplint.Objects.Interface
81240
81252
  || obj instanceof abaplint.Objects.FunctionGroup
81241
- // hmm || obj instanceof abaplint.Objects.Program
81253
+ || (options?.importProg === true && obj instanceof abaplint.Objects.Program)
81242
81254
  || obj instanceof abaplint.Objects.Class) {
81243
81255
  list.push(name);
81244
81256
  }
@@ -82964,10 +82976,10 @@ class DataTranspiler {
82964
82976
  }
82965
82977
  const ret = new chunk_1.Chunk()
82966
82978
  .appendString("let ")
82967
- .append(traversal_1.Traversal.prefixVariable(traversal_1.Traversal.escapeNamespace(found.getName().toLowerCase())), token, traversal)
82979
+ .appendString(traversal_1.Traversal.prefixVariable(traversal_1.Traversal.escapeNamespace(found.getName().toLowerCase())))
82968
82980
  .appendString(" = " + new transpile_types_1.TranspileTypes().toType(found.getType()))
82969
- .append(";", node.getLastToken(), traversal)
82970
- .append(value, node.getLastToken(), traversal);
82981
+ .appendString(";")
82982
+ .appendString(value);
82971
82983
  return ret;
82972
82984
  }
82973
82985
  static buildValue(node, name, traversal) {
@@ -83810,9 +83822,9 @@ class FieldSymbolTranspiler {
83810
83822
  }
83811
83823
  if (name) {
83812
83824
  return new chunk_1.Chunk()
83813
- .append("let ", node, traversal)
83814
- .appendChunk(new field_symbol_1.FieldSymbolTranspiler().transpile(name, traversal))
83815
- .append(" = new abap.types.FieldSymbol(" + new transpile_types_1.TranspileTypes().toType(found.getType()) + ");", node.getLastToken(), traversal);
83825
+ .appendString("let ")
83826
+ .appendString(new field_symbol_1.FieldSymbolTranspiler().transpile(name, traversal).getCode())
83827
+ .appendString(" = new abap.types.FieldSymbol(" + new transpile_types_1.TranspileTypes().toType(found.getType()) + ");");
83816
83828
  }
83817
83829
  throw new Error("FieldSymbolTranspiler, name not found");
83818
83830
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.10.59",
3
+ "version": "2.10.60",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -27,10 +27,10 @@
27
27
  "author": "abaplint",
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
- "@abaplint/core": "^2.113.125",
31
- "@abaplint/transpiler": "^2.10.59",
30
+ "@abaplint/core": "^2.113.126",
31
+ "@abaplint/transpiler": "^2.10.60",
32
32
  "@types/glob": "^8.1.0",
33
- "@types/node": "^22.15.29",
33
+ "@types/node": "^22.15.30",
34
34
  "@types/progress": "^2.0.7",
35
35
  "glob": "=7.2.0",
36
36
  "progress": "^2.0.3",