@abaplint/runtime 2.7.50 → 2.7.52

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,3 +1,4 @@
1
+ import { Structure } from "../types";
1
2
  import { ICharacter } from "../types/_character";
2
3
  import { INumeric } from "../types/_numeric";
3
- export declare function ca(left: number | string | ICharacter | INumeric, right: string | ICharacter): boolean;
4
+ export declare function ca(left: number | string | ICharacter | INumeric | Structure, right: string | ICharacter): boolean;
@@ -1,11 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ca = void 0;
4
+ const types_1 = require("../types");
4
5
  function ca(left, right) {
6
+ if (left instanceof types_1.FieldSymbol) {
7
+ return ca(left.getPointer(), right);
8
+ }
9
+ else if (right instanceof types_1.FieldSymbol) {
10
+ return ca(left, right.getPointer());
11
+ }
5
12
  let l = "";
6
13
  if (typeof left === "number" || typeof left === "string") {
7
14
  l = left.toString();
8
15
  }
16
+ else if (left instanceof types_1.Structure) {
17
+ l = left.getCharacter();
18
+ }
9
19
  else {
10
20
  l = left.get().toString();
11
21
  }
@@ -73,6 +73,8 @@ async function deleteInternal(target, options) {
73
73
  }
74
74
  return;
75
75
  }
76
+ // @ts-ignore
77
+ const originalTabix = abap.builtin.sy.get().tabix.get();
76
78
  try {
77
79
  for (var _d = true, _e = __asyncValues((0, loop_1.loop)(target)), _f; _f = await _e.next(), _a = _f.done, !_a; _d = true) {
78
80
  _c = _f.value;
@@ -100,6 +102,10 @@ async function deleteInternal(target, options) {
100
102
  else if ((options === null || options === void 0 ? void 0 : options.from) && options.from.get() <= index + 1) {
101
103
  target.deleteIndex(index);
102
104
  }
105
+ else if (options === undefined && originalTabix === index) {
106
+ // short form, "DELETE tab"
107
+ target.deleteIndex(index - 1);
108
+ }
103
109
  }
104
110
  }
105
111
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -30,7 +30,7 @@ function searchWithKey(arr, withKey, startIndex = 0, usesTableLine) {
30
30
  }
31
31
  /////////////////
32
32
  function readTable(table, options) {
33
- var _a, _b, _c, _d;
33
+ var _a, _b, _c, _d, _e;
34
34
  let found = undefined;
35
35
  let foundIndex = 0;
36
36
  let binarySubrc = undefined;
@@ -146,13 +146,14 @@ function readTable(table, options) {
146
146
  foundIndex = searchResult.foundIndex;
147
147
  }
148
148
  else if (options === null || options === void 0 ? void 0 : options.from) {
149
- if (options.from instanceof types_1.FieldSymbol) {
150
- options.from = options.from.getPointer();
151
- }
152
149
  if (table instanceof types_1.HashedTable) {
153
150
  throw new Error("runtime, todo readTable Hashed FROM");
154
151
  }
152
+ if (options.from instanceof types_1.FieldSymbol) {
153
+ options.from = options.from.getPointer();
154
+ }
155
155
  if (table instanceof types_1.Table && options.from instanceof types_1.Structure) {
156
+ // todo: optimize if the primary key is sorted
156
157
  const arr = table.array();
157
158
  const keys = (_d = (_c = table.getOptions()) === null || _c === void 0 ? void 0 : _c.primaryKey) === null || _d === void 0 ? void 0 : _d.keyFields;
158
159
  const isStructured = arr[0] instanceof types_1.Structure;
@@ -178,6 +179,9 @@ function readTable(table, options) {
178
179
  if (found === undefined) {
179
180
  foundIndex = 0;
180
181
  }
182
+ if (found === undefined && ((_e = table.getOptions().primaryKey) === null || _e === void 0 ? void 0 : _e.type) === types_1.TableAccessType.sorted) {
183
+ binarySubrc = 8;
184
+ }
181
185
  }
182
186
  else {
183
187
  throw new Error("runtime, readTable, unexpected input");
@@ -186,7 +190,7 @@ function readTable(table, options) {
186
190
  if (binarySubrc) {
187
191
  subrc = binarySubrc;
188
192
  }
189
- else if (((options === null || options === void 0 ? void 0 : options.from) || (options === null || options === void 0 ? void 0 : options.binarySearch) === true || (options === null || options === void 0 ? void 0 : options.keyName) !== undefined)
193
+ else if (((options === null || options === void 0 ? void 0 : options.binarySearch) === true || (options === null || options === void 0 ? void 0 : options.keyName) !== undefined)
190
194
  && subrc === 4) {
191
195
  subrc = 8;
192
196
  }
@@ -8,6 +8,7 @@ const field_symbol_1 = require("./field_symbol");
8
8
  const integer_1 = require("./integer");
9
9
  const packed_1 = require("./packed");
10
10
  const structure_1 = require("./structure");
11
+ const float_1 = require("./float");
11
12
  class String {
12
13
  constructor(input) {
13
14
  this.value = "";
@@ -46,6 +47,10 @@ class String {
46
47
  this.value = Math.abs(value.get()) + "";
47
48
  this.value += lv_sign;
48
49
  }
50
+ else if (value instanceof float_1.Float) {
51
+ this.value = value.get() + "";
52
+ this.value = this.value.replace(",", ".");
53
+ }
49
54
  else {
50
55
  this.value = value.get() + "";
51
56
  }
@@ -107,6 +107,7 @@ export declare class Table implements ITable {
107
107
  set(tab: Table | TableRowType): this;
108
108
  getHeader(): TableRowType;
109
109
  insertIndex(item: TableRowType, index: number, noClone?: boolean): any;
110
+ /** index = javascript indexed */
110
111
  deleteIndex(index: number): void;
111
112
  append(item: TableRowType): any;
112
113
  appendInitial(): TableRowType;
@@ -364,6 +364,7 @@ class Table {
364
364
  }
365
365
  return val;
366
366
  }
367
+ /** index = javascript indexed */
367
368
  deleteIndex(index) {
368
369
  this.secondaryIndexes = {};
369
370
  if (index > this.value.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.7.50",
3
+ "version": "2.7.52",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",