@abaplint/runtime 2.6.22 → 2.6.24

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.
@@ -7,6 +7,12 @@ function escape(input) {
7
7
  let val = typeof input.val === "string" ? input.val : input.val.get();
8
8
  const format = typeof input.format === "number" ? input.format : input.format.get();
9
9
  switch (format) {
10
+ case 1: // e_xml_attr
11
+ val = val.replace(/&/g, "&");
12
+ val = val.replace(/</g, "&lt;");
13
+ val = val.replace(/"/g, "&quot;");
14
+ val = val.replace(/'/g, "&apos;");
15
+ break;
10
16
  case 4: // e_html_text
11
17
  val = val.replace(/&/g, "&amp;");
12
18
  val = val.replace(/</g, "&lt;");
@@ -22,6 +28,10 @@ function escape(input) {
22
28
  case 12: // e_url
23
29
  val = encodeURI(val);
24
30
  break;
31
+ case 24: // e_json_string
32
+ val = val.replace(/"/g, "\\\"");
33
+ val = val.replace(/\n/g, "\\n");
34
+ break;
25
35
  default:
26
36
  // todo, runtime error
27
37
  }
@@ -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.22",
3
+ "version": "2.6.24",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",