@abaplint/transpiler 2.5.12 → 2.5.14
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.
|
@@ -6,5 +6,5 @@ export declare class FieldChainTranspiler implements IExpressionTranspiler {
|
|
|
6
6
|
private readonly addGet;
|
|
7
7
|
private addGetOffset;
|
|
8
8
|
constructor(addGet?: boolean);
|
|
9
|
-
transpile(node: Nodes.ExpressionNode, traversal: Traversal, prefix?: boolean, filename?: string): Chunk;
|
|
9
|
+
transpile(node: Nodes.ExpressionNode, traversal: Traversal, prefix?: boolean, filename?: string, wrongScope?: boolean): Chunk;
|
|
10
10
|
}
|
|
@@ -10,7 +10,7 @@ class FieldChainTranspiler {
|
|
|
10
10
|
constructor(addGet = false) {
|
|
11
11
|
this.addGet = addGet;
|
|
12
12
|
}
|
|
13
|
-
transpile(node, traversal, prefix = true, filename) {
|
|
13
|
+
transpile(node, traversal, prefix = true, filename, wrongScope = false) {
|
|
14
14
|
const ret = new chunk_1.Chunk();
|
|
15
15
|
const extra = [];
|
|
16
16
|
for (const c of node.getChildren()) {
|
|
@@ -25,6 +25,9 @@ class FieldChainTranspiler {
|
|
|
25
25
|
else if (c instanceof core_1.Nodes.ExpressionNode && c.get() instanceof core_1.Expressions.ClassName) {
|
|
26
26
|
const name = traversal.lookupClassOrInterface(c.getFirstToken().getStr(), c.getFirstToken());
|
|
27
27
|
ret.append(name + ".", c, traversal);
|
|
28
|
+
if (wrongScope === true && traversal.reg.getObject("INTF", c.getFirstToken().getStr())) {
|
|
29
|
+
ret.append(traversal_1.Traversal.escapeNamespace(c.getFirstToken().getStr().toLocaleLowerCase()) + "$", c, traversal);
|
|
30
|
+
}
|
|
28
31
|
}
|
|
29
32
|
else if (c.get() instanceof core_1.Expressions.AttributeName) {
|
|
30
33
|
const interfaceName = traversal.isInterfaceAttribute(c.getFirstToken());
|
|
@@ -102,7 +102,7 @@ class MethodImplementationTranspiler {
|
|
|
102
102
|
}
|
|
103
103
|
else {
|
|
104
104
|
// note: this can be difficult, the "def" might be from an interface, ie. a different scope than the method
|
|
105
|
-
val = new expressions_1.FieldChainTranspiler().transpile(parameterDefault, traversal, true, methodDef === null || methodDef === void 0 ? void 0 : methodDef.getFilename()).getCode();
|
|
105
|
+
val = new expressions_1.FieldChainTranspiler().transpile(parameterDefault, traversal, true, methodDef === null || methodDef === void 0 ? void 0 : methodDef.getFilename(), true).getCode();
|
|
106
106
|
if (val.startsWith(parameterDefault.getFirstToken().getStr().toLowerCase()) === true) {
|
|
107
107
|
val = "this." + val;
|
|
108
108
|
}
|
package/build/src/traversal.js
CHANGED
|
@@ -506,14 +506,14 @@ class Traversal {
|
|
|
506
506
|
traverseStructure(node) {
|
|
507
507
|
const list = StructureTranspilers;
|
|
508
508
|
const ret = new chunk_1.Chunk();
|
|
509
|
+
const search = node.get().constructor.name + "Transpiler";
|
|
510
|
+
if (list[search]) {
|
|
511
|
+
const transpiler = new list[search]();
|
|
512
|
+
ret.appendChunk(transpiler.transpile(node, this));
|
|
513
|
+
return ret;
|
|
514
|
+
}
|
|
509
515
|
for (const c of node.getChildren()) {
|
|
510
516
|
if (c instanceof abaplint.Nodes.StructureNode) {
|
|
511
|
-
const search = c.get().constructor.name + "Transpiler";
|
|
512
|
-
if (list[search]) {
|
|
513
|
-
const transpiler = new list[search]();
|
|
514
|
-
ret.appendChunk(transpiler.transpile(c, this));
|
|
515
|
-
continue;
|
|
516
|
-
}
|
|
517
517
|
ret.appendChunk(this.traverseStructure(c));
|
|
518
518
|
}
|
|
519
519
|
else if (c instanceof abaplint.Nodes.StatementNode) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.14",
|
|
4
4
|
"description": "Transpiler",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/src/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"author": "abaplint",
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@abaplint/core": "^2.95.
|
|
31
|
+
"@abaplint/core": "^2.95.29",
|
|
32
32
|
"source-map": "^0.7.4"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|