@abaplint/runtime 2.6.12 → 2.6.14

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.
@@ -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,7 +8,12 @@ function concatenate(input) {
8
8
  const tab = input.source[0];
9
9
  if (tab instanceof types_1.Table) {
10
10
  for (const l of tab.array()) {
11
- list.push(l.get().trimEnd());
11
+ if (input.respectingBlanks !== true) {
12
+ list.push(l.get().trimEnd());
13
+ }
14
+ else {
15
+ list.push(l.get());
16
+ }
12
17
  }
13
18
  }
14
19
  }
@@ -22,9 +27,11 @@ function concatenate(input) {
22
27
  val = source.toString();
23
28
  }
24
29
  else if (source instanceof types_1.Character) {
25
- val = source.get().toString();
26
30
  if (input.respectingBlanks !== true) {
27
- val = val.replace(/ +$/, "");
31
+ val = source.getTrimEnd();
32
+ }
33
+ else {
34
+ val = source.get();
28
35
  }
29
36
  }
30
37
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.6.12",
3
+ "version": "2.6.14",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",