@abaplint/transpiler 2.11.13 → 2.11.15
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.
|
@@ -22,6 +22,14 @@ class TargetTranspiler {
|
|
|
22
22
|
ret.append(traversal_1.Traversal.prefixVariable(traversal_1.Traversal.escapeNamespace(prefix)), c, traversal);
|
|
23
23
|
context = scope?.findVariable(c.getFirstToken().getStr())?.getType();
|
|
24
24
|
}
|
|
25
|
+
else if (c.get() instanceof core_1.Expressions.InlineData && c instanceof core_1.Nodes.ExpressionNode) {
|
|
26
|
+
const targetField = c.findDirectExpression(core_1.Expressions.TargetField);
|
|
27
|
+
if (targetField === undefined) {
|
|
28
|
+
throw new Error("TargetTranspiler: InlineData Target field not found");
|
|
29
|
+
}
|
|
30
|
+
ret.append(traversal_1.Traversal.prefixVariable(traversal_1.Traversal.escapeNamespace(targetField?.concatTokens())), c, traversal);
|
|
31
|
+
context = scope?.findVariable(targetField.getFirstToken().getStr())?.getType();
|
|
32
|
+
}
|
|
25
33
|
else if (c.get() instanceof core_1.Expressions.ClassName) {
|
|
26
34
|
const name = traversal.lookupClassOrInterface(c.getFirstToken().getStr(), c.getFirstToken());
|
|
27
35
|
ret.append(name, c, traversal);
|
package/build/src/inline.js
CHANGED
|
@@ -3,14 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.InlineDeclarations = void 0;
|
|
4
4
|
const abaplint = require("@abaplint/core");
|
|
5
5
|
const transpile_types_1 = require("./transpile_types");
|
|
6
|
+
const statements_1 = require("./statements");
|
|
6
7
|
class InlineDeclarations {
|
|
7
8
|
static buildDeclarations(node, traversal) {
|
|
8
|
-
const
|
|
9
|
+
const inlineDataExpressions = node.findAllExpressionsRecursive(abaplint.Expressions.InlineData);
|
|
9
10
|
let result = "";
|
|
10
|
-
for (const expression of
|
|
11
|
+
for (const expression of inlineDataExpressions) {
|
|
11
12
|
const name = expression.findFirstExpression(abaplint.Expressions.TargetField)?.concatTokens();
|
|
12
13
|
if (name === undefined) {
|
|
13
|
-
throw new Error("InlineDeclarations: no target field found");
|
|
14
|
+
throw new Error("InlineDeclarations: no target data field found");
|
|
14
15
|
}
|
|
15
16
|
const scope = traversal.findCurrentScopeByToken(expression.getFirstToken());
|
|
16
17
|
const variable = scope?.findVariable(name);
|
|
@@ -19,6 +20,15 @@ class InlineDeclarations {
|
|
|
19
20
|
}
|
|
20
21
|
result += transpile_types_1.TranspileTypes.declare(variable) + "\n";
|
|
21
22
|
}
|
|
23
|
+
// todo: declare DATA and FSes according to when they appear in the code
|
|
24
|
+
const inlineFieldSymbols = node.findAllExpressionsRecursive(abaplint.Expressions.InlineFS);
|
|
25
|
+
for (const expression of inlineFieldSymbols) {
|
|
26
|
+
const target = expression.findFirstExpression(abaplint.Expressions.TargetFieldSymbol);
|
|
27
|
+
if (target === undefined) {
|
|
28
|
+
throw new Error("InlineDeclarations: no target fs field found");
|
|
29
|
+
}
|
|
30
|
+
result += new statements_1.FieldSymbolTranspiler().transpile(target, traversal).getCode();
|
|
31
|
+
}
|
|
22
32
|
return result;
|
|
23
33
|
}
|
|
24
34
|
}
|
|
@@ -9,7 +9,11 @@ class AssignTranspiler {
|
|
|
9
9
|
transpile(node, traversal) {
|
|
10
10
|
const assignSource = node.findDirectExpression(abaplint.Expressions.AssignSource);
|
|
11
11
|
const sources = assignSource?.findDirectExpressionsMulti([abaplint.Expressions.Source, abaplint.Expressions.SimpleSource3]).map(e => new expressions_1.SourceTranspiler(false).transpile(e, traversal).getCode()) || [];
|
|
12
|
-
|
|
12
|
+
let fsTarget = node.findDirectExpression(abaplint.Expressions.FSTarget);
|
|
13
|
+
if (fsTarget?.getFirstChild()?.get() instanceof abaplint.Expressions.InlineFS) {
|
|
14
|
+
fsTarget = fsTarget.findFirstExpression(abaplint.Expressions.TargetFieldSymbol);
|
|
15
|
+
}
|
|
16
|
+
const fs = new expressions_1.FieldSymbolTranspiler().transpile(fsTarget, traversal).getCode();
|
|
13
17
|
const options = [];
|
|
14
18
|
const concat = node.concatTokens().toUpperCase();
|
|
15
19
|
if (concat.startsWith("ASSIGN COMPONENT ")) {
|
|
@@ -3,5 +3,5 @@ import { IStatementTranspiler } from "./_statement_transpiler";
|
|
|
3
3
|
import { Traversal } from "../traversal";
|
|
4
4
|
import { Chunk } from "../chunk";
|
|
5
5
|
export declare class FieldSymbolTranspiler implements IStatementTranspiler {
|
|
6
|
-
transpile(node: abaplint.Nodes.StatementNode, traversal: Traversal): Chunk;
|
|
6
|
+
transpile(node: abaplint.Nodes.StatementNode | abaplint.Nodes.ExpressionNode, traversal: Traversal): Chunk;
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.15",
|
|
4
4
|
"description": "Transpiler",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/src/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"author": "abaplint",
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@abaplint/core": "^2.113.
|
|
32
|
+
"@abaplint/core": "^2.113.163",
|
|
33
33
|
"source-map": "^0.7.6"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|