@abaplint/transpiler 2.1.88 → 2.1.90

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.
@@ -18,9 +18,9 @@ class ConstantTranspiler {
18
18
  }
19
19
  return new chunk_1.Chunk().append(ret, node, traversal);
20
20
  }
21
- let str = node.findFirstExpression(core_1.Expressions.ConstantString);
21
+ let str = node.findDirectExpression(core_1.Expressions.ConstantString);
22
22
  if (str === undefined) {
23
- str = node.findFirstExpression(core_1.Expressions.TextElementString);
23
+ str = node.findDirectExpression(core_1.Expressions.TextElementString);
24
24
  }
25
25
  if (str) {
26
26
  let res = str.getFirstToken().getStr();
@@ -40,6 +40,30 @@ class ConstantTranspiler {
40
40
  return new chunk_1.Chunk().append(code, node, traversal);
41
41
  }
42
42
  }
43
+ const concat = node.findDirectExpression(core_1.Expressions.ConcatenatedConstant);
44
+ if (concat) {
45
+ const chunk = new chunk_1.Chunk().appendString("abap.operators.concat([");
46
+ let first = true;
47
+ for (const child of concat.getChildren()) {
48
+ const res = child.getFirstToken().getStr();
49
+ if (first === true) {
50
+ first = false;
51
+ }
52
+ else if (res !== "&") {
53
+ chunk.appendString(",");
54
+ }
55
+ if (res.startsWith("'") && this.addGet === false) {
56
+ const code = "new abap.types.Character({length: " + (res.length - 2) + "}).set(" + this.escape(res) + ")";
57
+ chunk.append(code, node, traversal);
58
+ }
59
+ else if (res.startsWith("`") && this.addGet === false) {
60
+ const code = "new abap.types.String().set(" + this.escape(res) + ")";
61
+ chunk.append(code, node, traversal);
62
+ }
63
+ }
64
+ chunk.appendString("])");
65
+ return chunk;
66
+ }
43
67
  return new chunk_1.Chunk(`todo, Constant`);
44
68
  }
45
69
  escape(str) {
@@ -256,6 +256,9 @@ class Traversal {
256
256
  && def.getMethodDefinitions().getByName("CONSTRUCTOR") === undefined) {
257
257
  ret += `await super.constructor_(INPUT);\n`;
258
258
  }
259
+ const cName = Traversal.escapeClassName(def.getName().toLowerCase());
260
+ ret += "this.INTERNAL_TYPE = " + cName + ".INTERNAL_TYPE;\n";
261
+ ret += "this.IMPLEMENTED_INTERFACES = " + cName + ".IMPLEMENTED_INTERFACES;\n";
259
262
  ret += "this.me = new abap.types.ABAPObject();\n";
260
263
  ret += "this.me.set(this);\n";
261
264
  for (const a of def.getAttributes().getAll()) {
@@ -275,7 +278,7 @@ class Traversal {
275
278
  }
276
279
  // constants can be accessed both statically and via reference
277
280
  for (const c of def.getAttributes().getConstants()) {
278
- ret += "this." + c.getName().toLowerCase() + " = " + Traversal.escapeClassName(def.getName().toLowerCase()) + "." + c.getName().toLowerCase() + ";\n";
281
+ ret += "this." + c.getName().toLowerCase() + " = " + cName + "." + c.getName().toLowerCase() + ";\n";
279
282
  }
280
283
  return ret;
281
284
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.1.88",
3
+ "version": "2.1.90",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",