@abaplint/runtime 2.0.61 → 2.0.64

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,32 @@ 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.dynamicText.includes("->") && input.dynamicSource instanceof types_1.ABAPObject) {
8
+ const split = input.dynamicText.split("->");
9
+ // @ts-ignore
10
+ input.dynamicSource = input.dynamicSource.get()[split[1].toLowerCase()];
11
+ }
12
+ if (input.dynamicSource) {
13
+ input.target.assign(input.dynamicSource);
14
+ // @ts-ignore
15
+ abap.builtin.sy.get().subrc.set(0);
16
+ }
17
+ else {
18
+ // @ts-ignore
19
+ abap.builtin.sy.get().subrc.set(4);
20
+ }
21
+ }
22
+ else if (input.component) {
7
23
  if (input.source instanceof types_1.FieldSymbol || input.source instanceof types_1.DataReference) {
8
24
  input.source = input.source.getPointer();
9
25
  assign(input);
10
26
  return;
11
27
  }
12
28
  else if (!(input.source instanceof types_1.Structure)) {
13
- throw "ASSIGN, not a structure"; // todo, this should be a runtime error?
29
+ // @ts-ignore
30
+ abap.builtin.sy.get().subrc.set(4);
31
+ return;
14
32
  }
15
33
  let component = input.component;
16
34
  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) {
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.0.61",
3
+ "version": "2.0.64",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",