@abaplint/runtime 2.3.23 → 2.3.25

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.
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.assign = void 0;
4
4
  const types_1 = require("../types");
5
5
  function assign(input) {
6
+ var _a;
6
7
  if (input.dynamicName) {
7
8
  if (input.dynamicSource instanceof types_1.FieldSymbol) {
8
9
  input.dynamicSource = input.dynamicSource.getPointer();
@@ -68,10 +69,12 @@ function assign(input) {
68
69
  component = component.get();
69
70
  }
70
71
  if (input.source instanceof types_1.Table) {
71
- input.source = input.source.getHeader();
72
- }
73
- if (input.source instanceof types_1.Table) {
74
- throw "ASSIGN, nested table";
72
+ if (((_a = input.source.getOptions()) === null || _a === void 0 ? void 0 : _a.withHeader) === true) {
73
+ input.source = input.source.getHeader();
74
+ }
75
+ else {
76
+ // result is the table itself, no change of input.source
77
+ }
75
78
  }
76
79
  let result = undefined;
77
80
  if (typeof component === "number") {
@@ -85,7 +88,7 @@ function assign(input) {
85
88
  result = structure_as_object[component_name];
86
89
  }
87
90
  }
88
- else {
91
+ else if (!(input.source instanceof types_1.Table)) {
89
92
  result = input.source.get()[component.toLowerCase()];
90
93
  }
91
94
  if (result === undefined) {
@@ -16,11 +16,26 @@ function createData(target, options) {
16
16
  }
17
17
  else if (options === null || options === void 0 ? void 0 : options.name) {
18
18
  // @ts-ignore
19
- if (abap.DDIC[options.name] === undefined) {
19
+ if (abap.DDIC[options.name]) {
20
+ // @ts-ignore
21
+ target.assign((0, clone_1.clone)(abap.DDIC[options.name].type));
22
+ }
23
+ else if (options.name.includes("=>")) {
24
+ const [className, typeName] = options.name.toUpperCase().split("=>");
25
+ // @ts-ignore
26
+ if (abap.Classes[className] === undefined) {
27
+ (0, throw_error_1.throwError)("CX_SY_CREATE_DATA_ERROR");
28
+ }
29
+ // @ts-ignore
30
+ if (abap.Classes[className][typeName.toLowerCase()] === undefined) {
31
+ (0, throw_error_1.throwError)("CX_SY_CREATE_DATA_ERROR");
32
+ }
33
+ // @ts-ignore
34
+ target.assign((0, clone_1.clone)(abap.Classes[className][typeName.toLowerCase()]));
35
+ }
36
+ else {
20
37
  (0, throw_error_1.throwError)("CX_SY_CREATE_DATA_ERROR");
21
38
  }
22
- // @ts-ignore
23
- target.assign((0, clone_1.clone)(abap.DDIC[options.name].type));
24
39
  }
25
40
  else if (options === null || options === void 0 ? void 0 : options.typeName) {
26
41
  switch (options.typeName) {
@@ -70,7 +85,22 @@ function createData(target, options) {
70
85
  target.assign(new types_1.XString());
71
86
  break;
72
87
  default:
73
- throw "CREATE DATA, unknown type " + options.typeName;
88
+ if (options.typeName.includes("=>")) {
89
+ const [className, typeName] = options.typeName.toUpperCase().split("=>");
90
+ // @ts-ignore
91
+ if (abap.Classes[className] === undefined) {
92
+ (0, throw_error_1.throwError)("CX_SY_CREATE_DATA_ERROR");
93
+ }
94
+ // @ts-ignore
95
+ if (abap.Classes[className][typeName.toLowerCase()] === undefined) {
96
+ (0, throw_error_1.throwError)("CX_SY_CREATE_DATA_ERROR");
97
+ }
98
+ // @ts-ignore
99
+ target.assign((0, clone_1.clone)(abap.Classes[className][typeName.toLowerCase()]));
100
+ }
101
+ else {
102
+ throw "CREATE DATA, unknown type " + options.typeName;
103
+ }
74
104
  }
75
105
  }
76
106
  else if (options === null || options === void 0 ? void 0 : options.type) {
@@ -8,7 +8,7 @@ function throwError(name) {
8
8
  throw new abap.Classes[name]();
9
9
  }
10
10
  else {
11
- throw "Global class name not found";
11
+ throw `Global class ${name} not found`;
12
12
  }
13
13
  }
14
14
  exports.throwError = throwError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.3.23",
3
+ "version": "2.3.25",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",