@abaplint/runtime 2.7.78 → 2.7.80
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.
- package/build/src/abap_regex.js +1 -1
- package/build/src/builtin/replace.js +2 -3
- package/build/src/statements/insert_internal.js +2 -2
- package/build/src/statements/sort.d.ts +2 -1
- package/build/src/statements/sort.js +7 -1
- package/build/src/types/table.d.ts +0 -2
- package/build/src/types/table.js +6 -4
- package/package.json +1 -1
package/build/src/abap_regex.js
CHANGED
|
@@ -30,8 +30,7 @@ function replace(input) {
|
|
|
30
30
|
sub = input.sub.get();
|
|
31
31
|
}
|
|
32
32
|
if (sub !== undefined) {
|
|
33
|
-
sub =
|
|
34
|
-
sub = sub.replace(/\[/g, "\\[");
|
|
33
|
+
sub = abap_regex_1.ABAPRegExp.escapeRegExp(sub);
|
|
35
34
|
}
|
|
36
35
|
if (typeof input.regex === "string") {
|
|
37
36
|
sub = new RegExp(abap_regex_1.ABAPRegExp.convert(input.regex), "g");
|
|
@@ -51,7 +50,7 @@ function replace(input) {
|
|
|
51
50
|
wi +
|
|
52
51
|
input.val.getOffset({ offset: offset + length }).get();
|
|
53
52
|
}
|
|
54
|
-
else if (input.occ === undefined && sub && wi) {
|
|
53
|
+
else if (input.occ === undefined && sub && wi !== undefined) {
|
|
55
54
|
val = val.replace(sub, wi);
|
|
56
55
|
}
|
|
57
56
|
else if (input.occ && input.occ.get() === 0 && sub && wi !== undefined) {
|
|
@@ -147,10 +147,10 @@ function insertInternal(options) {
|
|
|
147
147
|
by = [];
|
|
148
148
|
}
|
|
149
149
|
if (by && by.length > 0) {
|
|
150
|
-
(0, sort_1.sort)(options.table, { by: by });
|
|
150
|
+
(0, sort_1.sort)(options.table, { by: by, skipSortedCheck: true });
|
|
151
151
|
}
|
|
152
152
|
else {
|
|
153
|
-
(0, sort_1.sort)(options.table);
|
|
153
|
+
(0, sort_1.sort)(options.table, { skipSortedCheck: true });
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { FieldSymbol, Table } from "../types";
|
|
2
2
|
export interface ISortOptions {
|
|
3
3
|
descending?: boolean;
|
|
4
|
+
skipSortedCheck?: boolean;
|
|
4
5
|
by?: {
|
|
5
6
|
component: string;
|
|
6
7
|
descending?: boolean;
|
|
7
8
|
}[];
|
|
8
9
|
}
|
|
9
|
-
export declare function sort(input: Table | FieldSymbol, options?: ISortOptions): void;
|
|
10
|
+
export declare function sort(input: Table | FieldSymbol | any[], options?: ISortOptions): void;
|
|
@@ -42,7 +42,8 @@ function compare(a, b, input) {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
function sort(input, options) {
|
|
45
|
-
// console.dir(
|
|
45
|
+
// console.dir(input);
|
|
46
|
+
var _a, _b;
|
|
46
47
|
if (input instanceof types_1.FieldSymbol) {
|
|
47
48
|
const pnt = input.getPointer();
|
|
48
49
|
if (pnt === undefined) {
|
|
@@ -51,6 +52,11 @@ function sort(input, options) {
|
|
|
51
52
|
sort(pnt, options);
|
|
52
53
|
return;
|
|
53
54
|
}
|
|
55
|
+
else if ((options === null || options === void 0 ? void 0 : options.skipSortedCheck) !== true
|
|
56
|
+
&& input instanceof types_1.Table
|
|
57
|
+
&& ((_b = (_a = input.getOptions()) === null || _a === void 0 ? void 0 : _a.primaryKey) === null || _b === void 0 ? void 0 : _b.type) === types_1.TableAccessType.sorted) {
|
|
58
|
+
throw new Error("SORT called on sorted table");
|
|
59
|
+
}
|
|
54
60
|
if (input instanceof types_1.HashedTable) {
|
|
55
61
|
throw new Error("Sort hashed table, ugh?");
|
|
56
62
|
}
|
|
@@ -46,8 +46,6 @@ export declare let featureHashedTables: boolean;
|
|
|
46
46
|
export declare class TableFactory {
|
|
47
47
|
static construct(rowType: TableRowType, options?: ITableOptions, qualifiedName?: string): Table | HashedTable;
|
|
48
48
|
}
|
|
49
|
-
export declare class SortedTable {
|
|
50
|
-
}
|
|
51
49
|
export declare class HashedTable implements ITable {
|
|
52
50
|
private value;
|
|
53
51
|
private readonly header;
|
package/build/src/types/table.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Table = exports.HashedTable = exports.
|
|
3
|
+
exports.Table = exports.HashedTable = exports.TableFactory = exports.featureHashedTables = exports.LoopController = exports.TableKeyType = exports.TableAccessType = void 0;
|
|
4
4
|
const integer_1 = require("./integer");
|
|
5
5
|
const string_1 = require("./string");
|
|
6
6
|
const clone_1 = require("../clone");
|
|
@@ -57,9 +57,11 @@ class TableFactory {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
exports.TableFactory = TableFactory;
|
|
60
|
-
|
|
60
|
+
/*
|
|
61
|
+
export class SortedTable {
|
|
62
|
+
// todo
|
|
61
63
|
}
|
|
62
|
-
|
|
64
|
+
*/
|
|
63
65
|
class HashedTable {
|
|
64
66
|
constructor(rowType, options, qualifiedName) {
|
|
65
67
|
this.value = {};
|
|
@@ -277,7 +279,7 @@ class Table {
|
|
|
277
279
|
throw `Table, secondary key "${name}" not found`;
|
|
278
280
|
}
|
|
279
281
|
const copy = [...this.value];
|
|
280
|
-
(0, sort_1.sort)(copy, { by: secondary.keyFields.map(k => { return { component: k.toLowerCase() }; }) });
|
|
282
|
+
(0, sort_1.sort)(copy, { by: secondary.keyFields.map(k => { return { component: k.toLowerCase() }; }), skipSortedCheck: true });
|
|
281
283
|
this.secondaryIndexes[name.toUpperCase()] = copy;
|
|
282
284
|
return copy;
|
|
283
285
|
}
|