@abaplint/transpiler-cli 2.12.35 → 2.13.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 +16 -5
  2. package/package.json +2 -2
package/build/bundle.js CHANGED
@@ -85033,7 +85033,7 @@ class HandleDataElement {
85033
85033
  }
85034
85034
  const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
85035
85035
  "objectType": "DTEL",
85036
- "type": ${transpile_types_1.TranspileTypes.toType(type)},
85036
+ "type": ${transpile_types_1.TranspileTypes.toTypeFunction(type)},
85037
85037
  "domain": ${JSON.stringify(obj.getDomainName())},
85038
85038
  "fixedValues": ${JSON.stringify(fixedValues)},
85039
85039
  "description": ${JSON.stringify(obj.getDescription())},
@@ -85328,7 +85328,7 @@ class HandleTable {
85328
85328
  const type = obj.parseType(reg);
85329
85329
  const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
85330
85330
  "objectType": "TABL",
85331
- "type": ${transpile_types_1.TranspileTypes.toType(type)},
85331
+ "type": ${transpile_types_1.TranspileTypes.toTypeFunction(type)},
85332
85332
  "keyFields": ${JSON.stringify(obj.listKeys(reg))},
85333
85333
  "description": ${JSON.stringify(obj.getDescription())},
85334
85334
  };`);
@@ -85371,7 +85371,7 @@ class HandleTableType {
85371
85371
  const type = obj.parseType(reg);
85372
85372
  const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
85373
85373
  "objectType": "TTYP",
85374
- "type": ${transpile_types_1.TranspileTypes.toType(type)},
85374
+ "type": ${transpile_types_1.TranspileTypes.toTypeFunction(type)},
85375
85375
  "description": ${JSON.stringify(obj.getDescription())},
85376
85376
  };`);
85377
85377
  const output = {
@@ -85478,7 +85478,7 @@ class HandleView {
85478
85478
  const type = obj.parseType(reg);
85479
85479
  const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
85480
85480
  "objectType": "VIEW",
85481
- "type": ${transpile_types_1.TranspileTypes.toType(type)},
85481
+ "type": ${transpile_types_1.TranspileTypes.toTypeFunction(type)},
85482
85482
  };`);
85483
85483
  // todo, "keyFields": ${JSON.stringify(obj.listKeys())},
85484
85484
  const output = {
@@ -93567,7 +93567,7 @@ class SelectTranspiler {
93567
93567
  // note: this implementation SELECTs everything into memory, which might be bad, and sometimes not correct
93568
93568
  const targetName = unique_identifier_1.UniqueIdentifier.get();
93569
93569
  const loopName = unique_identifier_1.UniqueIdentifier.get();
93570
- ret.appendString(`let ${targetName} = new abap.types.Table(abap.DDIC["${from}"].type);\n`);
93570
+ ret.appendString(`let ${targetName} = new abap.types.Table(abap.DDIC["${from}"].type());\n`);
93571
93571
  ret.appendChunk(new select_1.SelectTranspiler().transpile(selectStatement, traversal, targetName));
93572
93572
  // todo: optimize, it should do real streaming?
93573
93573
  const packageSize = node.findFirstExpression(abaplint.Expressions.SelectLoop)?.findExpressionAfterToken("SIZE");
@@ -93792,6 +93792,17 @@ class TranspileTypes {
93792
93792
  }
93793
93793
  return pre + t.getName().toLowerCase() + " = " + code + ";\n";
93794
93794
  }
93795
+ /** this returns a function, so it doesnt throw when loading the code, only when running */
93796
+ static toTypeFunction(type) {
93797
+ if (type instanceof abaplint.BasicTypes.UnknownType) {
93798
+ return `() => { throw new Error("Unknown type: ${type.getError()}") }`;
93799
+ }
93800
+ else if (type instanceof abaplint.BasicTypes.VoidType) {
93801
+ return `() => { throw new Error("Void type: ${type.getVoided()}") }`;
93802
+ }
93803
+ // return singleton,
93804
+ return "(() => { let _t; return () => (_t ??= " + this.toType(type) + "); })()";
93805
+ }
93795
93806
  static toType(type) {
93796
93807
  let resolved = "";
93797
93808
  let extra = "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.12.35",
3
+ "version": "2.13.0",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -28,7 +28,7 @@
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
30
  "@abaplint/core": "^2.118.1",
31
- "@abaplint/transpiler": "^2.12.35",
31
+ "@abaplint/transpiler": "^2.13.0",
32
32
  "@types/glob": "^8.1.0",
33
33
  "@types/node": "^24.12.0",
34
34
  "@types/progress": "^2.0.7",