@abaplint/runtime 2.4.9 → 2.4.11

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.
@@ -34,6 +34,7 @@ export declare class Table {
34
34
  private readonly loops;
35
35
  private readonly options;
36
36
  private readonly qualifiedName;
37
+ private readonly isStructured;
37
38
  private secondaryIndexes;
38
39
  constructor(rowType: TableRowType, options?: ITableOptions, qualifiedName?: string);
39
40
  getKeyByName(name: string): ITableKey | undefined;
@@ -49,7 +50,7 @@ export declare class Table {
49
50
  getHeader(): TableRowType;
50
51
  insertIndex(item: TableRowType, index: number): TableRowType;
51
52
  deleteIndex(index: number): void;
52
- append(item: TableRowType, cloneRow?: boolean): FieldSymbol | DataReference | TableRowType;
53
+ append(item: TableRowType): FieldSymbol | DataReference | TableRowType;
53
54
  appendInitial(): TableRowType;
54
55
  sort(compareFn: (a: TableRowType, b: TableRowType) => number): void;
55
56
  private getValue;
@@ -4,6 +4,7 @@ exports.Table = exports.LoopIndex = exports.TableAccessType = void 0;
4
4
  const integer_1 = require("./integer");
5
5
  const string_1 = require("./string");
6
6
  const clone_1 = require("../clone");
7
+ const structure_1 = require("./structure");
7
8
  const field_symbol_1 = require("./field_symbol");
8
9
  const data_reference_1 = require("./data_reference");
9
10
  const insert_internal_1 = require("../statements/insert_internal");
@@ -29,6 +30,7 @@ class Table {
29
30
  this.loops = new Set();
30
31
  this.rowType = rowType;
31
32
  this.options = options;
33
+ this.isStructured = rowType instanceof structure_1.Structure;
32
34
  if ((options === null || options === void 0 ? void 0 : options.withHeader) === true) {
33
35
  this.header = (0, clone_1.clone)(this.rowType);
34
36
  }
@@ -147,7 +149,7 @@ class Table {
147
149
  }
148
150
  }
149
151
  }
150
- append(item, cloneRow = true) {
152
+ append(item) {
151
153
  this.secondaryIndexes = {};
152
154
  if (item instanceof field_symbol_1.FieldSymbol) {
153
155
  const p = item.getPointer();
@@ -162,13 +164,20 @@ class Table {
162
164
  ref.assign(item.getPointer());
163
165
  this.value.push(ref);
164
166
  return ref;
167
+ // @ts-ignore
168
+ // eslint-disable-next-line max-len
169
+ }
170
+ else if (this.isStructured === true && item.getQualifiedName && this.rowType.getQualifiedName && item.getQualifiedName() !== "" && item.getQualifiedName() === this.rowType.getQualifiedName()) {
171
+ // hmm, moving this to getValue() should, but does not work
172
+ // types match, so no need to do conversions, just clone the item
173
+ const val = (0, clone_1.clone)(item);
174
+ this.value.push(val);
175
+ return val;
165
176
  }
166
177
  else {
167
- const val = this.getValue(item, cloneRow);
168
- const p = (0, clone_1.clone)(this.rowType);
169
- p.set(val);
170
- this.value.push(p);
171
- return p;
178
+ const val = this.getValue(item);
179
+ this.value.push(val);
180
+ return val;
172
181
  }
173
182
  }
174
183
  appendInitial() {
@@ -183,7 +192,7 @@ class Table {
183
192
  this.value.sort(compareFn);
184
193
  }
185
194
  ///////////////////////////
186
- getValue(item, cloneRow = true) {
195
+ getValue(item) {
187
196
  // make sure to do conversion if needed
188
197
  if (typeof item === "number") {
189
198
  const tmp = (0, clone_1.clone)(this.getRowType());
@@ -195,14 +204,11 @@ class Table {
195
204
  tmp.set(new string_1.String().set(item));
196
205
  return tmp;
197
206
  }
198
- else if (cloneRow === true) {
207
+ else {
199
208
  const tmp = (0, clone_1.clone)(this.getRowType());
200
209
  tmp.set(item);
201
210
  return tmp;
202
211
  }
203
- else {
204
- return item;
205
- }
206
212
  }
207
213
  }
208
214
  exports.Table = Table;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.4.9",
3
+ "version": "2.4.11",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -36,6 +36,6 @@
36
36
  "typescript": "^4.8.4"
37
37
  },
38
38
  "dependencies": {
39
- "temporal-polyfill": "^0.0.8"
39
+ "temporal-polyfill": "^0.1.0"
40
40
  }
41
41
  }