@abaplint/transpiler 1.7.25 → 1.7.26

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.
@@ -0,0 +1,5 @@
1
+ import * as abaplint from "@abaplint/core";
2
+ import { IOutputFile } from "./types";
3
+ export declare class HandleDataElement {
4
+ runObject(obj: abaplint.Objects.DataElement, reg: abaplint.IRegistry): IOutputFile[];
5
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HandleDataElement = void 0;
4
+ const chunk_1 = require("./chunk");
5
+ const transpile_types_1 = require("./transpile_types");
6
+ class HandleDataElement {
7
+ runObject(obj, reg) {
8
+ var _a;
9
+ const filename = (_a = obj.getXMLFile()) === null || _a === void 0 ? void 0 : _a.getFilename().replace(".xml", ".mjs").toLowerCase();
10
+ if (filename === undefined) {
11
+ return [];
12
+ }
13
+ const type = obj.parseType(reg);
14
+ const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
15
+ "type": ${new transpile_types_1.TranspileTypes().toType(type)},
16
+ };`);
17
+ const output = {
18
+ object: {
19
+ name: obj.getName(),
20
+ type: obj.getType(),
21
+ },
22
+ filename: filename,
23
+ chunk: chunk,
24
+ requires: [],
25
+ exports: [],
26
+ };
27
+ return [output];
28
+ }
29
+ }
30
+ exports.HandleDataElement = HandleDataElement;
31
+ //# sourceMappingURL=handle_data_element.js.map
@@ -0,0 +1,5 @@
1
+ import * as abaplint from "@abaplint/core";
2
+ import { IOutputFile } from "./types";
3
+ export declare class HandleTableType {
4
+ runObject(obj: abaplint.Objects.TableType, reg: abaplint.IRegistry): IOutputFile[];
5
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HandleTableType = void 0;
4
+ const chunk_1 = require("./chunk");
5
+ const transpile_types_1 = require("./transpile_types");
6
+ class HandleTableType {
7
+ runObject(obj, reg) {
8
+ var _a;
9
+ const filename = (_a = obj.getXMLFile()) === null || _a === void 0 ? void 0 : _a.getFilename().replace(".xml", ".mjs").toLowerCase();
10
+ if (filename === undefined) {
11
+ return [];
12
+ }
13
+ const type = obj.parseType(reg);
14
+ const chunk = new chunk_1.Chunk().appendString(`abap.DDIC["${obj.getName().toUpperCase()}"] = {
15
+ "type": ${new transpile_types_1.TranspileTypes().toType(type)},
16
+ };`);
17
+ const output = {
18
+ object: {
19
+ name: obj.getName(),
20
+ type: obj.getType(),
21
+ },
22
+ filename: filename,
23
+ chunk: chunk,
24
+ requires: [],
25
+ exports: [],
26
+ };
27
+ return [output];
28
+ }
29
+ }
30
+ exports.HandleTableType = HandleTableType;
31
+ //# sourceMappingURL=handle_table_type.js.map
@@ -9,6 +9,8 @@ const keywords_1 = require("./keywords");
9
9
  const database_setup_1 = require("./database_setup");
10
10
  const handle_table_1 = require("./handle_table");
11
11
  const handle_abap_1 = require("./handle_abap");
12
+ const handle_data_element_1 = require("./handle_data_element");
13
+ const handle_table_type_1 = require("./handle_table_type");
12
14
  class Transpiler {
13
15
  constructor(options) {
14
16
  this.options = options;
@@ -55,6 +57,12 @@ class Transpiler {
55
57
  else if (obj instanceof abaplint.Objects.Table) {
56
58
  output.objects.push(...new handle_table_1.HandleTable().runObject(obj, reg));
57
59
  }
60
+ else if (obj instanceof abaplint.Objects.DataElement) {
61
+ output.objects.push(...new handle_data_element_1.HandleDataElement().runObject(obj, reg));
62
+ }
63
+ else if (obj instanceof abaplint.Objects.TableType) {
64
+ output.objects.push(...new handle_table_type_1.HandleTableType().runObject(obj, reg));
65
+ }
58
66
  }
59
67
  return output;
60
68
  }
@@ -4,9 +4,10 @@ exports.CreateDataTranspiler = void 0;
4
4
  const abaplint = require("@abaplint/core");
5
5
  const chunk_1 = require("../chunk");
6
6
  const expressions_1 = require("../expressions");
7
+ const transpile_types_1 = require("../transpile_types");
7
8
  class CreateDataTranspiler {
8
9
  transpile(node, traversal) {
9
- var _a, _b;
10
+ var _a, _b, _c;
10
11
  const targetNode = node.findDirectExpression(abaplint.Expressions.Target);
11
12
  const target = traversal.traverse(targetNode);
12
13
  const options = [];
@@ -20,6 +21,13 @@ class CreateDataTranspiler {
20
21
  options.push(`"name": ` + new expressions_1.FieldChainTranspiler(true).transpile(dynamic, traversal).getCode());
21
22
  }
22
23
  }
24
+ const typeNameNode = node.findDirectExpression(abaplint.Expressions.TypeName);
25
+ if (typeNameNode) {
26
+ const id = (_c = traversal.findCurrentScopeByToken(typeNameNode.getFirstToken())) === null || _c === void 0 ? void 0 : _c.findType(typeNameNode.concatTokens());
27
+ if (id) {
28
+ options.push(`"type": ` + new transpile_types_1.TranspileTypes().toType(id.getType()));
29
+ }
30
+ }
23
31
  if (node.findDirectTokenByText("TABLE")) {
24
32
  options.push(`"table": true`);
25
33
  }
@@ -106,6 +106,12 @@ run().then(() => {
106
106
  if (obj instanceof abaplint.Objects.Table) {
107
107
  list.push(`await import("./${obj.getName().toLowerCase()}.tabl.mjs");`);
108
108
  }
109
+ else if (obj instanceof abaplint.Objects.DataElement) {
110
+ list.push(`await import("./${obj.getName().toLowerCase()}.dtel.mjs");`);
111
+ }
112
+ else if (obj instanceof abaplint.Objects.TableType) {
113
+ list.push(`await import("./${obj.getName().toLowerCase()}.ttyp.mjs");`);
114
+ }
109
115
  }
110
116
  for (const obj of reg.getObjects()) {
111
117
  if (obj instanceof abaplint.Objects.FunctionGroup) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "1.7.25",
3
+ "version": "1.7.26",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",