@abaplint/runtime 2.5.79 → 2.6.1

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.
@@ -10,6 +10,7 @@ function numofchar(input) {
10
10
  else {
11
11
  str = input.val.get();
12
12
  }
13
+ str = str.trimEnd();
13
14
  return new types_1.Integer().set(str.length);
14
15
  }
15
16
  exports.numofchar = numofchar;
@@ -27,6 +27,16 @@ function eq(left, right) {
27
27
  else if (left instanceof types_1.FieldSymbol) {
28
28
  return eq(left.getPointer(), right);
29
29
  }
30
+ // for performance, do the typicaly/easy cases first
31
+ if (right instanceof types_1.Character && left instanceof types_1.Character && right.getLength() === left.getLength()) {
32
+ return right.get() === left.get();
33
+ }
34
+ else if (right instanceof types_1.Numc && left instanceof types_1.Numc && right.getLength() === left.getLength()) {
35
+ return right.get() === left.get();
36
+ }
37
+ else if (right instanceof types_1.Integer && left instanceof types_1.Integer) {
38
+ return right.get() === left.get();
39
+ }
30
40
  if (left instanceof types_1.Table || right instanceof types_1.Table || left instanceof types_1.HashedTable || right instanceof types_1.HashedTable) {
31
41
  if ((left instanceof types_1.Table || left instanceof types_1.HashedTable)
32
42
  && (right instanceof types_1.Table || right instanceof types_1.HashedTable)) {
@@ -63,6 +73,9 @@ function eq(left, right) {
63
73
  if (left instanceof types_1.Character) {
64
74
  l = left.getTrimEnd();
65
75
  }
76
+ else if (left instanceof types_1.Date) {
77
+ l = left.get().trimEnd();
78
+ }
66
79
  else if (typeof left === "object") {
67
80
  l = left.get();
68
81
  }
@@ -73,6 +86,9 @@ function eq(left, right) {
73
86
  if (right instanceof types_1.Character) {
74
87
  r = right.getTrimEnd();
75
88
  }
89
+ else if (right instanceof types_1.Date) {
90
+ l = right.get().trimEnd();
91
+ }
76
92
  else if (typeof right === "object") {
77
93
  r = right.get();
78
94
  }
@@ -95,7 +95,7 @@ function assign(input) {
95
95
  }
96
96
  }
97
97
  else if (!(input.source instanceof types_1.Table)) {
98
- result = input.source.get()[component.toLowerCase()];
98
+ result = input.source.get()[component.toLowerCase().trimEnd()];
99
99
  }
100
100
  if (result === undefined) {
101
101
  // not a field in the structure
@@ -8,7 +8,7 @@ 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());
11
+ list.push(l.get().trimEnd());
12
12
  }
13
13
  }
14
14
  }
@@ -39,8 +39,9 @@ function convert(source, target) {
39
39
  else {
40
40
  zone = source.zone.get() + "";
41
41
  }
42
+ zone = zone.trimEnd();
42
43
  }
43
- if (zone === "") {
44
+ if (zone.trim() === "") {
44
45
  zone = "UTC";
45
46
  }
46
47
  ////////////////////////
@@ -48,7 +48,7 @@ class Character {
48
48
  this.value = this.value.substr(0, this.length);
49
49
  }
50
50
  else if (this.value.length < this.length) {
51
- this.value.padEnd(this.length, " ");
51
+ this.value = this.value.padEnd(this.length, " ");
52
52
  }
53
53
  return this;
54
54
  }
@@ -31,6 +31,12 @@ class Date {
31
31
  else {
32
32
  this.set(value.get());
33
33
  }
34
+ if (this.value.length > 8) {
35
+ this.value = this.value.substr(0, 8);
36
+ }
37
+ else if (this.value.length < 8) {
38
+ this.value = this.value.padEnd(8, " ");
39
+ }
34
40
  return this;
35
41
  }
36
42
  clear() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.5.79",
3
+ "version": "2.6.1",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",