@abaplint/runtime 2.10.46 → 2.10.47

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.
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.clone = clone;
4
4
  function clone(obj) {
5
+ // @ts-ignore
6
+ return obj.clone();
5
7
  // @ts-ignore
6
8
  if (obj.clone) {
7
9
  // @ts-ignore
@@ -8,6 +8,7 @@ export declare class Date implements ICharacter {
8
8
  constructor(input?: {
9
9
  qualifiedName?: string;
10
10
  });
11
+ clone(): Date;
11
12
  getQualifiedName(): string | undefined;
12
13
  set(value: INumeric | ICharacter | Hex | string | number): this;
13
14
  clear(): void;
@@ -10,6 +10,11 @@ class Date {
10
10
  this.clear();
11
11
  this.qualifiedName = input?.qualifiedName;
12
12
  }
13
+ clone() {
14
+ const n = new Date({ qualifiedName: this.qualifiedName });
15
+ n.value = this.value;
16
+ return n;
17
+ }
13
18
  getQualifiedName() {
14
19
  return this.qualifiedName;
15
20
  }
@@ -4,6 +4,7 @@ import { INumeric } from "./_numeric";
4
4
  export declare class DecFloat34 {
5
5
  private value;
6
6
  constructor();
7
+ clone(): DecFloat34;
7
8
  set(value: INumeric | ICharacter | Hex | string | number): this;
8
9
  clear(): void;
9
10
  getRaw(): number;
@@ -8,6 +8,11 @@ class DecFloat34 {
8
8
  constructor() {
9
9
  this.value = 0;
10
10
  }
11
+ clone() {
12
+ const n = new DecFloat34();
13
+ n.value = this.value;
14
+ return n;
15
+ }
11
16
  set(value) {
12
17
  if (typeof value === "number") {
13
18
  this.value = value;
@@ -11,6 +11,7 @@ export declare class FieldSymbol {
11
11
  private casting;
12
12
  private readonly type;
13
13
  constructor(type?: PointerType);
14
+ clone(): void;
14
15
  getQualifiedName(): any;
15
16
  assign(pointer: PointerType): void;
16
17
  setCasting(): void;
@@ -13,6 +13,9 @@ class FieldSymbol {
13
13
  this.casting = false;
14
14
  this.type = type;
15
15
  }
16
+ clone() {
17
+ throw new Error("FieldSymbol cannot be cloned");
18
+ }
16
19
  getQualifiedName() {
17
20
  // @ts-ignore
18
21
  return this.type.getQualifiedName();
@@ -7,6 +7,7 @@ export declare class Float {
7
7
  constructor(input?: {
8
8
  qualifiedName?: string;
9
9
  });
10
+ clone(): Float;
10
11
  getQualifiedName(): string | undefined;
11
12
  set(value: INumeric | ICharacter | Hex | string | number): this;
12
13
  clear(): void;
@@ -24,6 +24,11 @@ class Float {
24
24
  this.value = 0;
25
25
  this.qualifiedName = input?.qualifiedName;
26
26
  }
27
+ clone() {
28
+ const n = new Float({ qualifiedName: this.qualifiedName });
29
+ n.value = this.value;
30
+ return n;
31
+ }
27
32
  getQualifiedName() {
28
33
  return this.qualifiedName;
29
34
  }
@@ -12,6 +12,7 @@ export declare class Hex implements ICharacter {
12
12
  length?: number;
13
13
  qualifiedName?: string;
14
14
  });
15
+ clone(): Hex;
15
16
  getQualifiedName(): string | undefined;
16
17
  set(value: ICharacter | INumeric | string | number | Integer | Integer8 | Float | Hex | XString): Hex;
17
18
  getLength(): number;
@@ -13,6 +13,11 @@ class Hex {
13
13
  this.qualifiedName = input?.qualifiedName;
14
14
  this.clear();
15
15
  }
16
+ clone() {
17
+ const n = new Hex({ length: this.length, qualifiedName: this.qualifiedName });
18
+ n.value = this.value;
19
+ return n;
20
+ }
16
21
  getQualifiedName() {
17
22
  return this.qualifiedName;
18
23
  }
@@ -9,6 +9,7 @@ export declare class Integer8 {
9
9
  constructor(input?: {
10
10
  qualifiedName?: string;
11
11
  });
12
+ clone(): Integer8;
12
13
  getQualifiedName(): string | undefined;
13
14
  set(value: INumeric | ICharacter | Hex | string | number | bigint | Integer8 | Integer | Float): this;
14
15
  clear(): void;
@@ -15,6 +15,12 @@ class Integer8 {
15
15
  this.value = 0n;
16
16
  this.qualifiedName = input?.qualifiedName;
17
17
  }
18
+ clone() {
19
+ const n = new Integer8({ qualifiedName: this.qualifiedName });
20
+ // set without trigger checks and padding
21
+ n.value = this.value;
22
+ return n;
23
+ }
18
24
  getQualifiedName() {
19
25
  return this.qualifiedName;
20
26
  }
@@ -9,6 +9,7 @@ export declare class Numc implements ICharacter {
9
9
  length?: number;
10
10
  qualifiedName?: string;
11
11
  });
12
+ clone(): Numc;
12
13
  getQualifiedName(): string | undefined;
13
14
  set(value: INumeric | ICharacter | Hex | string | number, raw?: boolean): this;
14
15
  getLength(): number;
@@ -10,6 +10,12 @@ class Numc {
10
10
  this.qualifiedName = input?.qualifiedName;
11
11
  this.clear();
12
12
  }
13
+ clone() {
14
+ const n = new Numc({ length: this.length, qualifiedName: this.qualifiedName });
15
+ // set without trigger checks and padding
16
+ n.value = this.value;
17
+ return n;
18
+ }
13
19
  getQualifiedName() {
14
20
  return this.qualifiedName;
15
21
  }
@@ -9,6 +9,7 @@ export declare class Packed implements INumeric {
9
9
  decimals?: number;
10
10
  qualifiedName?: string;
11
11
  });
12
+ clone(): Packed;
12
13
  getQualifiedName(): string | undefined;
13
14
  private round;
14
15
  set(value: INumeric | number | string): this;
@@ -18,6 +18,11 @@ class Packed {
18
18
  }
19
19
  this.qualifiedName = input?.qualifiedName;
20
20
  }
21
+ clone() {
22
+ const n = new Packed({ length: this.length, decimals: this.decimals, qualifiedName: this.qualifiedName });
23
+ n.value = this.value;
24
+ return n;
25
+ }
21
26
  getQualifiedName() {
22
27
  return this.qualifiedName;
23
28
  }
@@ -8,6 +8,7 @@ export declare class String implements ICharacter {
8
8
  constructor(input?: {
9
9
  qualifiedName?: string;
10
10
  });
11
+ clone(): String;
11
12
  getQualifiedName(): string | undefined;
12
13
  set(value: ICharacter | string | number | FieldSymbol): String;
13
14
  clear(): void;
@@ -14,6 +14,11 @@ class String {
14
14
  this.value = "";
15
15
  this.qualifiedName = input?.qualifiedName;
16
16
  }
17
+ clone() {
18
+ const n = new String({ qualifiedName: this.qualifiedName });
19
+ n.value = this.value;
20
+ return n;
21
+ }
17
22
  getQualifiedName() {
18
23
  return this.qualifiedName;
19
24
  }
@@ -10,7 +10,9 @@ export declare class Structure {
10
10
  private readonly ddicName;
11
11
  private readonly suffix;
12
12
  private readonly asInclude;
13
- constructor(fields: any, qualifiedName?: string, ddicName?: string, suffix?: any, asInclude?: any);
13
+ constructor(fields: {
14
+ [key: string]: any;
15
+ }, qualifiedName?: string, ddicName?: string, suffix?: any, asInclude?: any);
14
16
  clone(): Structure;
15
17
  clear(): this;
16
18
  getDDICName(): string | undefined;
@@ -23,7 +25,9 @@ export declare class Structure {
23
25
  getQualifiedName(): string | undefined;
24
26
  set(input: Structure | string | INumeric | Table | ICharacter | FieldSymbol | undefined): this | undefined;
25
27
  private setCharacter;
26
- get(): any;
28
+ get(): {
29
+ [key: string]: any;
30
+ };
27
31
  getCharacter(): string;
28
32
  getOffset(input: {
29
33
  offset?: number | INumeric | Hex;
@@ -16,7 +16,14 @@ class Structure {
16
16
  this.asInclude = asInclude;
17
17
  }
18
18
  clone() {
19
- const n = new Structure((0, clone_1.clone)(this.value), this.qualifiedName, this.ddicName, this.suffix, this.asInclude);
19
+ const newValues = {};
20
+ for (const key in this.value) {
21
+ if (this.value[key] === undefined) {
22
+ throw new Error("Structure, clone: value is undefined, field " + key);
23
+ }
24
+ newValues[key] = this.value[key].clone();
25
+ }
26
+ const n = new Structure(newValues, this.qualifiedName, this.ddicName, this.suffix, this.asInclude);
20
27
  return n;
21
28
  }
22
29
  clear() {
@@ -55,6 +55,7 @@ export declare class HashedTable implements ITable {
55
55
  private readonly isStructured;
56
56
  private secondaryIndexes;
57
57
  constructor(rowType: TableRowType, options: ITableOptions, qualifiedName?: string);
58
+ clone(): void;
58
59
  getArrayLength(): number;
59
60
  getKeyByName(name: string): ITableKey | undefined;
60
61
  getSecondaryIndex(name: string): any[];
@@ -92,6 +93,7 @@ export declare class Table implements ITable {
92
93
  private readonly isStructured;
93
94
  private secondaryIndexes;
94
95
  constructor(rowType: TableRowType, options: ITableOptions, qualifiedName?: string);
96
+ clone(): Table;
95
97
  getArrayLength(): number;
96
98
  getKeyByName(name: string): ITableKey | undefined;
97
99
  getSecondaryIndex(name: string): TableRowType[];
@@ -77,6 +77,9 @@ class HashedTable {
77
77
  }
78
78
  this.qualifiedName = qualifiedName?.toUpperCase();
79
79
  }
80
+ clone() {
81
+ throw new Error("HashedTable, clone not implemented");
82
+ }
80
83
  getArrayLength() {
81
84
  return Object.keys(this.value).length;
82
85
  }
@@ -302,6 +305,14 @@ class Table {
302
305
  }
303
306
  this.qualifiedName = qualifiedName?.toUpperCase();
304
307
  }
308
+ clone() {
309
+ const copy = new Table(this.rowType, this.options, this.qualifiedName);
310
+ for (const val of this.value) {
311
+ // @ts-ignore
312
+ copy.value.push(val.clone());
313
+ }
314
+ return copy;
315
+ }
305
316
  getArrayLength() {
306
317
  return this.value.length;
307
318
  }
@@ -8,6 +8,7 @@ export declare class Time implements ICharacter {
8
8
  constructor(input?: {
9
9
  qualifiedName?: string;
10
10
  });
11
+ clone(): Time;
11
12
  getQualifiedName(): string | undefined;
12
13
  set(value: INumeric | ICharacter | Hex | string | number): this;
13
14
  clear(): void;
@@ -9,6 +9,11 @@ class Time {
9
9
  this.clear();
10
10
  this.qualifiedName = input?.qualifiedName;
11
11
  }
12
+ clone() {
13
+ const n = new Time({ qualifiedName: this.qualifiedName });
14
+ n.value = this.value;
15
+ return n;
16
+ }
12
17
  getQualifiedName() {
13
18
  return this.qualifiedName;
14
19
  }
@@ -7,6 +7,7 @@ export declare class UTCLong implements ICharacter {
7
7
  constructor(input?: {
8
8
  qualifiedName?: string;
9
9
  });
10
+ clone(): UTCLong;
10
11
  getQualifiedName(): string | undefined;
11
12
  getOffset(_input: {
12
13
  offset?: number | undefined;
@@ -6,6 +6,11 @@ class UTCLong {
6
6
  this.clear();
7
7
  this.qualifiedName = input?.qualifiedName;
8
8
  }
9
+ clone() {
10
+ const n = new UTCLong({ qualifiedName: this.qualifiedName });
11
+ n.value = this.value;
12
+ return n;
13
+ }
9
14
  getQualifiedName() {
10
15
  return this.qualifiedName;
11
16
  }
@@ -8,6 +8,7 @@ export declare class XString implements ICharacter {
8
8
  constructor(input?: {
9
9
  qualifiedName?: string;
10
10
  });
11
+ clone(): XString;
11
12
  getQualifiedName(): string | undefined;
12
13
  set(value: ICharacter | INumeric | string | number): this;
13
14
  clear(): void;
@@ -11,6 +11,11 @@ class XString {
11
11
  this.value = "";
12
12
  this.qualifiedName = input?.qualifiedName;
13
13
  }
14
+ clone() {
15
+ const n = new XString({ qualifiedName: this.qualifiedName });
16
+ n.value = this.value;
17
+ return n;
18
+ }
14
19
  getQualifiedName() {
15
20
  return this.qualifiedName;
16
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.10.46",
3
+ "version": "2.10.47",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",