@abaplint/runtime 2.6.21 → 2.6.23

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.
@@ -25,6 +25,7 @@ export * from "./replace";
25
25
  export * from "./reverse";
26
26
  export * from "./round";
27
27
  export * from "./segment";
28
+ export * from "./shift_right";
28
29
  export * from "./shift_left";
29
30
  export * from "./sign";
30
31
  export * from "./sin";
@@ -42,6 +42,7 @@ __exportStar(require("./replace"), exports);
42
42
  __exportStar(require("./reverse"), exports);
43
43
  __exportStar(require("./round"), exports);
44
44
  __exportStar(require("./segment"), exports);
45
+ __exportStar(require("./shift_right"), exports);
45
46
  __exportStar(require("./shift_left"), exports);
46
47
  __exportStar(require("./sign"), exports);
47
48
  __exportStar(require("./sin"), exports);
@@ -25,6 +25,9 @@ function shift_left(input) {
25
25
  const leftShifts = input.circular.get() % val.length;
26
26
  val = val.slice(leftShifts) + val.slice(0, leftShifts);
27
27
  }
28
+ else {
29
+ return shift_left({ val: input.val, sub: " " });
30
+ }
28
31
  return new string_1.String().set(val);
29
32
  }
30
33
  exports.shift_left = shift_left;
@@ -0,0 +1,9 @@
1
+ import { ICharacter } from "../types/_character";
2
+ import { INumeric } from "../types/_numeric";
3
+ export interface IShiftRight {
4
+ val: ICharacter | string;
5
+ sub?: ICharacter | string;
6
+ places?: ICharacter | INumeric | string;
7
+ circular?: INumeric;
8
+ }
9
+ export declare function shift_right(input: IShiftRight): ICharacter;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shift_right = void 0;
4
+ const string_1 = require("../types/string");
5
+ function shift_right(input) {
6
+ let val = typeof input.val === "string" ? input.val : input.val.get();
7
+ if (input.sub) {
8
+ const sub = typeof input.sub === "string" ? input.sub : input.sub.get();
9
+ while (val.endsWith(sub)) {
10
+ val = val.substr(0, val.length - sub.length);
11
+ }
12
+ }
13
+ else if (input.places) {
14
+ throw new Error("shift_right todo");
15
+ }
16
+ else if (input.circular) {
17
+ throw new Error("shift_right todo");
18
+ }
19
+ else {
20
+ return shift_right({ val: input.val, sub: " " });
21
+ }
22
+ return new string_1.String().set(val);
23
+ }
24
+ exports.shift_right = shift_right;
25
+ //# sourceMappingURL=shift_right.js.map
@@ -11,15 +11,13 @@ function assign(input) {
11
11
  }
12
12
  input.dynamicName = input.dynamicName.trimEnd();
13
13
  if (input.dynamicName.includes("->")) {
14
- if (input.dynamicSource instanceof types_1.ABAPObject) {
15
- const split = input.dynamicName.split("->");
16
- // @ts-ignore
17
- input.dynamicSource = input.dynamicSource.get()[split[1].toLowerCase()];
18
- }
19
- else if (input.dynamicSource instanceof types_1.DataReference) {
20
- const [_before, after] = input.dynamicName.split("->");
21
- // @ts-ignore
22
- input.dynamicSource = input.dynamicSource.get()[after.toLowerCase()];
14
+ if (input.dynamicSource instanceof types_1.ABAPObject || input.dynamicSource instanceof types_1.DataReference) {
15
+ const split = input.dynamicName.split(/->|-/);
16
+ split.shift();
17
+ for (const s of split) {
18
+ // @ts-ignore
19
+ input.dynamicSource = input.dynamicSource.get()[s.toLowerCase()];
20
+ }
23
21
  }
24
22
  else {
25
23
  // @ts-ignore
@@ -96,7 +94,11 @@ function assign(input) {
96
94
  }
97
95
  }
98
96
  else if (!(input.source instanceof types_1.Table)) {
99
- result = input.source.get()[component.toLowerCase().trimEnd()];
97
+ const split = component.toLowerCase().trimEnd().split("-");
98
+ result = input.source;
99
+ for (const s of split) {
100
+ result = result.get()[s];
101
+ }
100
102
  }
101
103
  if (result === undefined) {
102
104
  // not a field in the structure
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.6.21",
3
+ "version": "2.6.23",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",