@abaplint/transpiler 2.12.35 → 2.13.1

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.
@@ -19,7 +19,7 @@ class HandleDataElement {
19
19
  }
20
20
  const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
21
21
  "objectType": "DTEL",
22
- "type": ${transpile_types_1.TranspileTypes.toType(type)},
22
+ "type": ${transpile_types_1.TranspileTypes.toTypeFunction(type)},
23
23
  "domain": ${JSON.stringify(obj.getDomainName())},
24
24
  "fixedValues": ${JSON.stringify(fixedValues)},
25
25
  "description": ${JSON.stringify(obj.getDescription())},
@@ -13,7 +13,7 @@ class HandleTable {
13
13
  const type = obj.parseType(reg);
14
14
  const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
15
15
  "objectType": "TABL",
16
- "type": ${transpile_types_1.TranspileTypes.toType(type)},
16
+ "type": ${transpile_types_1.TranspileTypes.toTypeFunction(type)},
17
17
  "keyFields": ${JSON.stringify(obj.listKeys(reg))},
18
18
  "description": ${JSON.stringify(obj.getDescription())},
19
19
  };`);
@@ -12,7 +12,7 @@ class HandleTableType {
12
12
  const type = obj.parseType(reg);
13
13
  const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
14
14
  "objectType": "TTYP",
15
- "type": ${transpile_types_1.TranspileTypes.toType(type)},
15
+ "type": ${transpile_types_1.TranspileTypes.toTypeFunction(type)},
16
16
  "description": ${JSON.stringify(obj.getDescription())},
17
17
  };`);
18
18
  const output = {
@@ -13,7 +13,7 @@ class HandleView {
13
13
  const type = obj.parseType(reg);
14
14
  const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
15
15
  "objectType": "VIEW",
16
- "type": ${transpile_types_1.TranspileTypes.toType(type)},
16
+ "type": ${transpile_types_1.TranspileTypes.toTypeFunction(type)},
17
17
  };`);
18
18
  // todo, "keyFields": ${JSON.stringify(obj.listKeys())},
19
19
  const output = {
@@ -123,6 +123,7 @@ export * from "./select";
123
123
  export * from "./selection_screen";
124
124
  export * from "./set_bit";
125
125
  export * from "./set_dataset";
126
+ export * from "./set_extended_check";
126
127
  export * from "./set_handler";
127
128
  export * from "./set_language";
128
129
  export * from "./set_locale";
@@ -139,6 +139,7 @@ __exportStar(require("./select"), exports);
139
139
  __exportStar(require("./selection_screen"), exports);
140
140
  __exportStar(require("./set_bit"), exports);
141
141
  __exportStar(require("./set_dataset"), exports);
142
+ __exportStar(require("./set_extended_check"), exports);
142
143
  __exportStar(require("./set_handler"), exports);
143
144
  __exportStar(require("./set_language"), exports);
144
145
  __exportStar(require("./set_locale"), exports);
@@ -4,7 +4,7 @@ exports.RetryTranspiler = void 0;
4
4
  const chunk_1 = require("../chunk");
5
5
  class RetryTranspiler {
6
6
  transpile(_node, _traversal) {
7
- return new chunk_1.Chunk(`throw new Error("Retry, not supported, transpiler");`);
7
+ return new chunk_1.Chunk(`throw new Error("RETRY, not supported, transpiler");`);
8
8
  }
9
9
  }
10
10
  exports.RetryTranspiler = RetryTranspiler;
@@ -0,0 +1,7 @@
1
+ import * as abaplint from "@abaplint/core";
2
+ import { IStatementTranspiler } from "./_statement_transpiler";
3
+ import { Traversal } from "../traversal";
4
+ import { Chunk } from "../chunk";
5
+ export declare class SetExtendedCheckTranspiler implements IStatementTranspiler {
6
+ transpile(_node: abaplint.Nodes.StatementNode, _traversal: Traversal): Chunk;
7
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SetExtendedCheckTranspiler = void 0;
4
+ const chunk_1 = require("../chunk");
5
+ class SetExtendedCheckTranspiler {
6
+ transpile(_node, _traversal) {
7
+ return new chunk_1.Chunk(`throw new Error("SET EXTENDED CHECK, not supported, transpiler");`);
8
+ }
9
+ }
10
+ exports.SetExtendedCheckTranspiler = SetExtendedCheckTranspiler;
11
+ //# sourceMappingURL=set_extended_check.js.map
@@ -4,7 +4,7 @@ exports.StopTranspiler = void 0;
4
4
  const chunk_1 = require("../chunk");
5
5
  class StopTranspiler {
6
6
  transpile(_node, _traversal) {
7
- return new chunk_1.Chunk(`throw new Error("Stop, not supported, transpiler");`);
7
+ return new chunk_1.Chunk(`throw new Error("STOP, not supported, transpiler");`);
8
8
  }
9
9
  }
10
10
  exports.StopTranspiler = StopTranspiler;
@@ -26,7 +26,7 @@ class SelectTranspiler {
26
26
  // note: this implementation SELECTs everything into memory, which might be bad, and sometimes not correct
27
27
  const targetName = unique_identifier_1.UniqueIdentifier.get();
28
28
  const loopName = unique_identifier_1.UniqueIdentifier.get();
29
- ret.appendString(`let ${targetName} = new abap.types.Table(abap.DDIC["${from}"].type);\n`);
29
+ ret.appendString(`let ${targetName} = new abap.types.Table(abap.DDIC["${from}"].type());\n`);
30
30
  ret.appendChunk(new select_1.SelectTranspiler().transpile(selectStatement, traversal, targetName));
31
31
  // todo: optimize, it should do real streaming?
32
32
  const packageSize = node.findFirstExpression(abaplint.Expressions.SelectLoop)?.findExpressionAfterToken("SIZE");
@@ -2,5 +2,7 @@ import * as abaplint from "@abaplint/core";
2
2
  export declare class TranspileTypes {
3
3
  static declare(t: abaplint.TypedIdentifier): string;
4
4
  static declareStaticSkipVoid(pre: string, t: abaplint.TypedIdentifier): string;
5
+ /** this returns a function, so it doesnt throw when loading the code, only when running */
6
+ static toTypeFunction(type: abaplint.AbstractType): string;
5
7
  static toType(type: abaplint.AbstractType): string;
6
8
  }
@@ -18,6 +18,17 @@ class TranspileTypes {
18
18
  }
19
19
  return pre + t.getName().toLowerCase() + " = " + code + ";\n";
20
20
  }
21
+ /** this returns a function, so it doesnt throw when loading the code, only when running */
22
+ static toTypeFunction(type) {
23
+ if (type instanceof abaplint.BasicTypes.UnknownType) {
24
+ return `() => { throw new Error("Unknown type: ${type.getError()}") }`;
25
+ }
26
+ else if (type instanceof abaplint.BasicTypes.VoidType) {
27
+ return `() => { throw new Error("Void type: ${type.getVoided()}") }`;
28
+ }
29
+ // return singleton,
30
+ return "(() => { let _t; return () => (_t ??= " + this.toType(type) + "); })()";
31
+ }
21
32
  static toType(type) {
22
33
  let resolved = "";
23
34
  let extra = "";
@@ -100,9 +100,6 @@ exports.config = {
100
100
  "begin_end_names": true,
101
101
  "check_syntax": true,
102
102
  "form_no_dash": true,
103
- "obsolete_statement": {
104
- "setExtended": true,
105
- },
106
103
  "forbidden_identifier": {
107
104
  "check": [],
108
105
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.12.35",
3
+ "version": "2.13.1",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -29,7 +29,7 @@
29
29
  "author": "abaplint",
30
30
  "license": "MIT",
31
31
  "dependencies": {
32
- "@abaplint/core": "^2.118.1",
32
+ "@abaplint/core": "^2.118.2",
33
33
  "source-map": "^0.7.6"
34
34
  },
35
35
  "devDependencies": {