@abaplint/runtime 2.11.59 → 2.11.61

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.createData = createData;
4
4
  const throw_error_1 = require("../throw_error");
5
5
  const types_1 = require("../types");
6
+ const tableOptions = { withHeader: false, keyType: types_1.TableKeyType.default };
6
7
  function createData(target, options) {
7
8
  // console.dir(options);
8
9
  if (target instanceof types_1.FieldSymbol) {
@@ -16,8 +17,7 @@ function createData(target, options) {
16
17
  if (abap.DDIC[options.name.trimEnd()] === undefined) {
17
18
  (0, throw_error_1.throwError)("CX_SY_CREATE_DATA_ERROR");
18
19
  }
19
- // @ts-ignore
20
- target.assign(new abap.types.Table(abap.DDIC[options.name.trimEnd()].type));
20
+ target.assign(new abap.types.Table(abap.DDIC[options.name.trimEnd()].type, tableOptions));
21
21
  }
22
22
  else if (options?.name !== undefined) {
23
23
  if (abap.DDIC[options.name.trimEnd()]) {
@@ -181,7 +181,12 @@ function createData(target, options) {
181
181
  if (options.like instanceof types_1.FieldSymbol) {
182
182
  options.like = options.like.getPointer();
183
183
  }
184
- target.assign(options.like.clone());
184
+ if (options.table === true) {
185
+ target.assign(new abap.types.Table(options.like.clone(), tableOptions));
186
+ }
187
+ else {
188
+ target.assign(options.like.clone());
189
+ }
185
190
  }
186
191
  else {
187
192
  target.assign(target.getType()?.clone());
@@ -8,6 +8,7 @@ export declare class ABAPObject {
8
8
  });
9
9
  clone(): ABAPObject;
10
10
  get(): any;
11
+ getInternalID(): string | undefined;
11
12
  clear(): void;
12
13
  getQualifiedName(): string | undefined;
13
14
  getRTTIName(): string | undefined;
@@ -19,6 +19,9 @@ class ABAPObject {
19
19
  get() {
20
20
  return this.value;
21
21
  }
22
+ getInternalID() {
23
+ return "OpenABAPInternalObjectId=" + this.value?.INTERNAL_ID;
24
+ }
22
25
  clear() {
23
26
  this.value = undefined;
24
27
  }
@@ -30,7 +30,7 @@ export declare class Structure {
30
30
  get(): {
31
31
  [key: string]: any;
32
32
  };
33
- getCharacter(): string;
33
+ getCharacter(allowObject?: boolean): string;
34
34
  getOffset(input: {
35
35
  offset?: number | INumeric | Hex;
36
36
  length?: number | INumeric | Hex;
@@ -6,6 +6,7 @@ const table_1 = require("./table");
6
6
  const _parse_1 = require("../operators/_parse");
7
7
  const character_1 = require("./character");
8
8
  const throw_error_1 = require("../throw_error");
9
+ const abap_object_1 = require("./abap_object");
9
10
  class Structure {
10
11
  value;
11
12
  qualifiedName;
@@ -115,14 +116,21 @@ class Structure {
115
116
  get() {
116
117
  return this.value;
117
118
  }
118
- getCharacter() {
119
+ getCharacter(allowObject = false) {
119
120
  let val = "";
120
121
  for (const v in this.value) {
121
- if (this.value[v] instanceof Structure) {
122
- val += this.value[v].getCharacter();
122
+ const foo = this.value[v];
123
+ if (foo instanceof Structure) {
124
+ val += foo.getCharacter(allowObject);
125
+ }
126
+ else if (foo instanceof abap_object_1.ABAPObject) {
127
+ if (allowObject === false) {
128
+ throw new Error("Structure getCharacter: unexpected ABAPObject");
129
+ }
130
+ val += foo.getInternalID();
123
131
  }
124
132
  else {
125
- val += this.value[v].get();
133
+ val += foo.get();
126
134
  }
127
135
  }
128
136
  return val;
@@ -118,10 +118,10 @@ class HashedTable {
118
118
  for (const k of this.options.primaryKey.keyFields) {
119
119
  if (k === "TABLE_LINE") {
120
120
  if (data instanceof structure_1.Structure) {
121
- hash += k + ":" + data.getCharacter() + "|";
121
+ hash += k + ":" + data.getCharacter(true) + "|";
122
122
  }
123
123
  else if (data instanceof abap_object_1.ABAPObject) {
124
- const moo = "OpenABAPInternalObjectId=" + data.get().INTERNAL_ID;
124
+ const moo = data.getInternalID();
125
125
  hash += k + ":" + moo + "|";
126
126
  }
127
127
  else {
@@ -133,10 +133,10 @@ class HashedTable {
133
133
  // @ts-ignore
134
134
  let val = data.get()[k.toLowerCase()];
135
135
  if (val instanceof structure_1.Structure) {
136
- val = val.getCharacter();
136
+ val = val.getCharacter(true);
137
137
  }
138
138
  else if (val instanceof abap_object_1.ABAPObject) {
139
- val = "OpenABAPInternalObjectId=" + val.get().INTERNAL_ID;
139
+ val = val.getInternalID();
140
140
  }
141
141
  else {
142
142
  val = val.get();
@@ -181,10 +181,10 @@ class HashedTable {
181
181
  val = val.get();
182
182
  }
183
183
  else if (val instanceof abap_object_1.ABAPObject) {
184
- val = "OpenABAPInternalObjectId=" + val.get().INTERNAL_ID;
184
+ val = val.getInternalID();
185
185
  }
186
186
  else if (val instanceof structure_1.Structure) {
187
- val = val.getCharacter();
187
+ val = val.getCharacter(true);
188
188
  }
189
189
  else {
190
190
  // convert
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.11.59",
3
+ "version": "2.11.61",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",