@abaplint/runtime 2.11.16 → 2.11.17

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.
@@ -24,6 +24,7 @@ export declare class Structure {
24
24
  [key: string]: boolean;
25
25
  };
26
26
  getQualifiedName(): string | undefined;
27
+ setField(name: string, value: any): this;
27
28
  set(input: Structure | string | INumeric | Table | ICharacter | FieldSymbol | undefined): this | undefined;
28
29
  private setCharacter;
29
30
  get(): {
@@ -54,6 +54,13 @@ class Structure {
54
54
  getQualifiedName() {
55
55
  return this.qualifiedName;
56
56
  }
57
+ setField(name, value) {
58
+ if (this.value[name] === undefined) {
59
+ throw new Error("Structure, setField, field not found: " + name);
60
+ }
61
+ this.value[name].set(value);
62
+ return this;
63
+ }
57
64
  set(input) {
58
65
  if (input === undefined) {
59
66
  return;
@@ -71,6 +78,7 @@ class Structure {
71
78
  for (let i = 0; i < keys1.length; i++) {
72
79
  const key1 = keys1[i];
73
80
  const key2 = keys2[i];
81
+ // todo: can clone() be removed? might be needed for like Structure and Tables?
74
82
  this.value[key2].set(obj[key1].clone());
75
83
  }
76
84
  }
@@ -70,6 +70,7 @@ export declare class HashedTable implements ITable {
70
70
  value: TableRowType | undefined;
71
71
  subrc: number;
72
72
  };
73
+ appendThis(data: TableRowType): this;
73
74
  array(): any[];
74
75
  startLoop(from: number, to: number, array: any[]): LoopController;
75
76
  unregisterLoop(loop: LoopController): void;
@@ -112,6 +113,7 @@ export declare class Table implements ITable {
112
113
  /** index = javascript indexed */
113
114
  deleteIndex(index: number): void;
114
115
  append(item: TableRowType): any;
116
+ appendThis(item: TableRowType): this;
115
117
  appendInitial(): TableRowType;
116
118
  sort(compareFn: (a: TableRowType, b: TableRowType) => number): void;
117
119
  private cloneRow;
@@ -217,6 +217,10 @@ class HashedTable {
217
217
  return { value: val, subrc: 0 };
218
218
  }
219
219
  }
220
+ appendThis(data) {
221
+ this.insert(data);
222
+ return this;
223
+ }
220
224
  array() {
221
225
  // used for LOOP
222
226
  const ret = [];
@@ -396,7 +400,7 @@ class Table {
396
400
  }
397
401
  if (!(tab instanceof Table)
398
402
  && !(tab instanceof HashedTable)) {
399
- throw new Error("Table, set error");
403
+ throw new Error("Table, set error, " + tab.constructor.name);
400
404
  }
401
405
  if (tab === this) {
402
406
  return this;
@@ -474,6 +478,9 @@ class Table {
474
478
  }
475
479
  }
476
480
  append(item) {
481
+ if (item === undefined) {
482
+ throw new Error("APPEND, item is undefined");
483
+ }
477
484
  this.secondaryIndexes = {};
478
485
  if (item instanceof field_symbol_1.FieldSymbol) {
479
486
  const p = item.getPointer();
@@ -495,6 +502,11 @@ class Table {
495
502
  return val;
496
503
  }
497
504
  }
505
+ /* appends and returns this */
506
+ appendThis(item) {
507
+ this.append(item);
508
+ return this;
509
+ }
498
510
  appendInitial() {
499
511
  this.secondaryIndexes = {};
500
512
  // note that this will clone the object
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.11.16",
3
+ "version": "2.11.17",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",