@abaplint/runtime 2.0.62 → 2.0.65

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.
@@ -2,8 +2,10 @@ import { DataReference, FieldSymbol, Structure } from "../types";
2
2
  import { ICharacter } from "../types/_character";
3
3
  import { INumeric } from "../types/_numeric";
4
4
  export interface IAssignInput {
5
- source: INumeric | ICharacter | Structure | DataReference;
5
+ source?: INumeric | ICharacter | Structure | DataReference;
6
6
  target: FieldSymbol;
7
+ dynamicText?: string;
8
+ dynamicSource?: ICharacter;
7
9
  casting?: boolean;
8
10
  component?: string | ICharacter;
9
11
  }
@@ -3,14 +3,42 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.assign = void 0;
4
4
  const types_1 = require("../types");
5
5
  function assign(input) {
6
- if (input.component) {
6
+ if (input.dynamicText) {
7
+ if (input.dynamicSource instanceof types_1.FieldSymbol) {
8
+ input.dynamicSource = input.dynamicSource.getPointer();
9
+ }
10
+ if (input.dynamicText.includes("->")) {
11
+ if (input.dynamicSource instanceof types_1.ABAPObject) {
12
+ const split = input.dynamicText.split("->");
13
+ // @ts-ignore
14
+ input.dynamicSource = input.dynamicSource.get()[split[1].toLowerCase()];
15
+ }
16
+ else {
17
+ // @ts-ignore
18
+ abap.builtin.sy.get().subrc.set(4);
19
+ return;
20
+ }
21
+ }
22
+ if (input.dynamicSource) {
23
+ input.target.assign(input.dynamicSource);
24
+ // @ts-ignore
25
+ abap.builtin.sy.get().subrc.set(0);
26
+ }
27
+ else {
28
+ // @ts-ignore
29
+ abap.builtin.sy.get().subrc.set(4);
30
+ }
31
+ }
32
+ else if (input.component) {
7
33
  if (input.source instanceof types_1.FieldSymbol || input.source instanceof types_1.DataReference) {
8
34
  input.source = input.source.getPointer();
9
35
  assign(input);
10
36
  return;
11
37
  }
12
38
  else if (!(input.source instanceof types_1.Structure)) {
13
- throw "ASSIGN, not a structure"; // todo, this should be a runtime error?
39
+ // @ts-ignore
40
+ abap.builtin.sy.get().subrc.set(4);
41
+ return;
14
42
  }
15
43
  let component = input.component;
16
44
  if (typeof component !== "string") {
@@ -6,6 +6,7 @@ export interface ICreateDataOptions {
6
6
  table?: boolean;
7
7
  name?: string;
8
8
  type?: PointerType;
9
+ typeHandle?: ABAPObject;
9
10
  likeLineOf?: FieldSymbol | Table;
10
11
  }
11
12
  export declare function createData(target: DataReference, options?: ICreateDataOptions): void;
@@ -14,6 +14,24 @@ function createData(target, options) {
14
14
  // @ts-ignore
15
15
  target.assign(new abap.types.Table(abap.DDIC[options.name].type));
16
16
  }
17
+ else if (options === null || options === void 0 ? void 0 : options.typeHandle) {
18
+ switch (options.typeHandle.get().type_kind.get()) {
19
+ case "F":
20
+ target.assign(new types_1.Float());
21
+ break;
22
+ case "I":
23
+ target.assign(new types_1.Integer());
24
+ break;
25
+ case "D":
26
+ target.assign(new types_1.Date());
27
+ break;
28
+ case "T":
29
+ target.assign(new types_1.Time());
30
+ break;
31
+ default:
32
+ throw "CREATE DATA, unknown handle type";
33
+ }
34
+ }
17
35
  else if (options === null || options === void 0 ? void 0 : options.name) {
18
36
  // @ts-ignore
19
37
  if (abap.DDIC[options.name] === undefined) {
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.describe = void 0;
4
4
  const types_1 = require("../types");
5
5
  function describe(input) {
6
+ // console.dir(input);
6
7
  if (input.type) {
7
8
  if (input.field instanceof types_1.FieldSymbol) {
8
9
  describe({ field: input.field.getPointer(), type: input.type, length: input.length, mode: input.mode });
@@ -4,7 +4,8 @@ import { ABAPObject } from "./abap_object";
4
4
  import { Table } from "./table";
5
5
  import { String } from "./string";
6
6
  import { Structure } from "./structure";
7
- declare type PointerType = INumeric | Table | ICharacter | ABAPObject | undefined | Structure;
7
+ import { Float } from "./float";
8
+ declare type PointerType = INumeric | Table | ICharacter | ABAPObject | undefined | Structure | Float;
8
9
  export declare class DataReference {
9
10
  private pointer;
10
11
  private readonly type;
@@ -16,7 +17,7 @@ export declare class DataReference {
16
17
  clear(): void;
17
18
  get(): any;
18
19
  array(): any;
19
- set(value: any): void | ABAPObject | ICharacter | INumeric | Table | Structure;
20
+ set(value: any): void | ABAPObject | ICharacter | INumeric | Float | Table | Structure;
20
21
  getOffset(input: {
21
22
  offset: number;
22
23
  length: number;
@@ -19,7 +19,7 @@ export declare class FieldSymbol {
19
19
  get(): any;
20
20
  appendInitial(): import("./table").TableRowType | undefined;
21
21
  array(): any;
22
- set(value: any): void | Structure | undefined;
22
+ set(value: any): this;
23
23
  getOffset(input: {
24
24
  offset: number;
25
25
  length: number;
@@ -66,7 +66,8 @@ class FieldSymbol {
66
66
  }
67
67
  set(value) {
68
68
  var _a;
69
- return (_a = this.pointer) === null || _a === void 0 ? void 0 : _a.set(value);
69
+ (_a = this.pointer) === null || _a === void 0 ? void 0 : _a.set(value);
70
+ return this;
70
71
  }
71
72
  getOffset(input) {
72
73
  // Assuming we're interested in Strings here, for now...
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.0.62",
3
+ "version": "2.0.65",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",