@abaplint/runtime 2.6.13 → 2.6.15

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,7 +24,7 @@ function clone(obj) {
24
24
  // @ts-ignore
25
25
  // eslint-disable-next-line no-prototype-builtins
26
26
  if (obj.hasOwnProperty(attr)) {
27
- if (null == obj[attr] || "object" != typeof obj[attr]) {
27
+ if (null === obj[attr] || "object" !== typeof obj[attr]) {
28
28
  copy[attr] = obj[attr];
29
29
  }
30
30
  else {
@@ -1,4 +1,4 @@
1
- import { ABAPObject, FieldSymbol, Float, HashedTable, Hex, Structure, Table } from "../types";
1
+ import { ABAPObject, FieldSymbol, Float, HashedTable, String, Hex, Structure, Table } from "../types";
2
2
  import { ICharacter } from "../types/_character";
3
3
  import { INumeric } from "../types/_numeric";
4
- export declare function eq(left: number | string | ICharacter | INumeric | Float | ABAPObject | Structure | Hex | HashedTable | Table | FieldSymbol, right: number | string | ICharacter | INumeric | Float | ABAPObject | Structure | Hex | HashedTable | Table | FieldSymbol): boolean;
4
+ export declare function eq(left: number | string | ICharacter | INumeric | Float | String | ABAPObject | Structure | Hex | HashedTable | Table | FieldSymbol, right: number | string | ICharacter | INumeric | Float | String | ABAPObject | Structure | Hex | HashedTable | Table | FieldSymbol): boolean;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.eq = void 0;
4
+ /* eslint-disable max-len */
4
5
  const types_1 = require("../types");
5
6
  function compareTables(left, right) {
6
7
  const leftArray = left.array();
@@ -28,18 +29,37 @@ function eq(left, right) {
28
29
  return eq(left.getPointer(), right);
29
30
  }
30
31
  // for performance, do the typicaly/easy cases first
31
- /*
32
- if (right instanceof Character && left instanceof Character && right.getLength() === left.getLength()) {
33
- return right.get() === left.get();
34
- } else if (right instanceof Numc && left instanceof Numc && right.getLength() === left.getLength()) {
32
+ if (right instanceof types_1.Character) {
33
+ if (left instanceof types_1.Character) {
34
+ if (right.getLength() === left.getLength()) {
35
+ return right.get() === left.get();
36
+ }
37
+ else {
38
+ return right.getTrimEnd() === left.getTrimEnd();
39
+ }
40
+ }
41
+ else if (left instanceof types_1.String) {
42
+ return right.getTrimEnd() === left.get();
43
+ }
44
+ }
45
+ else if (right instanceof types_1.String) {
46
+ if (left instanceof types_1.Character) {
47
+ return right.get() === left.getTrimEnd();
48
+ }
49
+ else if (left instanceof types_1.String) {
50
+ return right.get() === left.get();
51
+ }
52
+ }
53
+ else if (right instanceof types_1.Numc && left instanceof types_1.Numc && right.getLength() === left.getLength()) {
35
54
  return right.get() === left.get();
36
- } else if (right instanceof Integer && left instanceof Integer) {
55
+ }
56
+ else if (right instanceof types_1.Integer && left instanceof types_1.Integer) {
37
57
  return right.get() === left.get();
38
- }
39
- */
40
- if (left instanceof types_1.Table || right instanceof types_1.Table || left instanceof types_1.HashedTable || right instanceof types_1.HashedTable) {
41
- if ((left instanceof types_1.Table || left instanceof types_1.HashedTable)
42
- && (right instanceof types_1.Table || right instanceof types_1.HashedTable)) {
58
+ }
59
+ else if (right instanceof types_1.Table
60
+ || right instanceof types_1.HashedTable) {
61
+ if (left instanceof types_1.Table
62
+ || left instanceof types_1.HashedTable) {
43
63
  return compareTables(left, right);
44
64
  }
45
65
  else {
@@ -51,7 +71,7 @@ function eq(left, right) {
51
71
  if (!(right instanceof types_1.Structure)) {
52
72
  return eq(left.getCharacter(), right);
53
73
  }
54
- if (!(left instanceof types_1.Structure)) {
74
+ else if (!(left instanceof types_1.Structure)) {
55
75
  return eq(left, right.getCharacter());
56
76
  }
57
77
  const l = left.get();
@@ -76,6 +96,9 @@ function eq(left, right) {
76
96
  else if (left instanceof types_1.Date) {
77
97
  l = left.get().trimEnd();
78
98
  }
99
+ else if (left instanceof types_1.Table || left instanceof types_1.HashedTable) {
100
+ return false;
101
+ }
79
102
  else if (typeof left === "object") {
80
103
  l = left.get();
81
104
  }
@@ -8,6 +8,7 @@ export interface IInsertInternalOptions {
8
8
  table: Table | HashedTable | FieldSymbol;
9
9
  referenceInto?: DataReference;
10
10
  assigning?: FieldSymbol;
11
+ noClone?: boolean;
11
12
  lines?: boolean;
12
13
  }
13
14
  export declare function insertInternal(options: IInsertInternalOptions): void;
@@ -122,7 +122,7 @@ function insertInternal(options) {
122
122
  }
123
123
  else if (data) {
124
124
  // todo, for now it just appends, this is not correct, but currently the table type is not known
125
- const val = options.table.insertIndex(data, options.table.getArrayLength());
125
+ const val = options.table.insertIndex(data, options.table.getArrayLength(), options.noClone);
126
126
  if (options.assigning) {
127
127
  options.assigning.assign(val);
128
128
  }
@@ -60,7 +60,7 @@ class SelectDatabase {
60
60
  targetRow.set(row[columnName]);
61
61
  }
62
62
  // @ts-ignore
63
- abap.statements.insertInternal({ table: target, data: targetRow });
63
+ abap.statements.insertInternal({ table: target, data: targetRow, noClone: true });
64
64
  }
65
65
  }
66
66
  else if (Array.isArray(target)) {
@@ -106,7 +106,7 @@ export declare class Table implements ITable {
106
106
  clear(): void;
107
107
  set(tab: Table | TableRowType): this;
108
108
  getHeader(): TableRowType;
109
- insertIndex(item: TableRowType, index: number): any;
109
+ insertIndex(item: TableRowType, index: number, noClone?: boolean): any;
110
110
  deleteIndex(index: number): void;
111
111
  append(item: TableRowType): any;
112
112
  appendInitial(): TableRowType;
@@ -322,7 +322,7 @@ class Table {
322
322
  }
323
323
  return this.header;
324
324
  }
325
- insertIndex(item, index) {
325
+ insertIndex(item, index, noClone = false) {
326
326
  this.secondaryIndexes = {};
327
327
  if (item instanceof field_symbol_1.FieldSymbol) {
328
328
  const p = item.getPointer();
@@ -332,7 +332,13 @@ class Table {
332
332
  this.insertIndex(p, index);
333
333
  return p;
334
334
  }
335
- const val = this.getValue(item);
335
+ let val;
336
+ if (noClone === false) {
337
+ val = this.getValue(item);
338
+ }
339
+ else {
340
+ val = item;
341
+ }
336
342
  if (index === 0) {
337
343
  this.value.unshift(val);
338
344
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.6.13",
3
+ "version": "2.6.15",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",