@abaplint/transpiler 2.10.82 → 2.11.0
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.
- package/build/src/chunk.js +2 -1
- package/build/src/db/index.js +1 -0
- package/build/src/db/schema_generation/pg_database_schema.js +1 -0
- package/build/src/db/schema_generation/snowflake_database_schema.js +1 -0
- package/build/src/db/schema_generation/sqlite_database_schema.js +1 -0
- package/build/src/expressions/component_chain_simple.js +1 -1
- package/build/src/expressions/constant.js +1 -0
- package/build/src/expressions/database_table.js +1 -0
- package/build/src/expressions/field_chain.js +2 -0
- package/build/src/expressions/method_call_body.js +1 -0
- package/build/src/expressions/method_call_param.js +1 -0
- package/build/src/expressions/method_source.js +1 -0
- package/build/src/expressions/simple_source3.js +1 -0
- package/build/src/expressions/source.js +1 -0
- package/build/src/handlers/handle_abap.js +1 -0
- package/build/src/handlers/handle_fugr.js +1 -0
- package/build/src/index.js +1 -0
- package/build/src/requires.js +1 -0
- package/build/src/statements/do.js +1 -0
- package/build/src/statements/end_do.js +1 -0
- package/build/src/statements/end_while.js +1 -0
- package/build/src/statements/loop.js +7 -6
- package/build/src/statements/when.js +1 -0
- package/build/src/statements/while.js +1 -0
- package/build/src/traversal.js +6 -1
- package/build/src/unique_identifier.js +2 -2
- package/build/src/validation.js +1 -0
- package/package.json +1 -1
package/build/src/chunk.js
CHANGED
package/build/src/db/index.js
CHANGED
|
@@ -11,6 +11,7 @@ const snowflake_database_schema_1 = require("./schema_generation/snowflake_datab
|
|
|
11
11
|
// Postgres is case sensitive, so all column names should be lower case
|
|
12
12
|
// Sqlite escapes field names with single qoute, postgres with double
|
|
13
13
|
class DatabaseSetup {
|
|
14
|
+
reg;
|
|
14
15
|
constructor(reg) {
|
|
15
16
|
this.reg = reg;
|
|
16
17
|
}
|
|
@@ -7,8 +7,8 @@ const traversal_1 = require("../traversal");
|
|
|
7
7
|
const field_length_1 = require("./field_length");
|
|
8
8
|
const field_offset_1 = require("./field_offset");
|
|
9
9
|
class ComponentChainSimpleTranspiler {
|
|
10
|
+
prefix = "";
|
|
10
11
|
constructor(prefix = "") {
|
|
11
|
-
this.prefix = "";
|
|
12
12
|
this.prefix = prefix;
|
|
13
13
|
}
|
|
14
14
|
transpile(node, traversal) {
|
|
@@ -9,6 +9,8 @@ const field_symbol_1 = require("./field_symbol");
|
|
|
9
9
|
const chunk_1 = require("../chunk");
|
|
10
10
|
const feature_flags_1 = require("../feature_flags");
|
|
11
11
|
class FieldChainTranspiler {
|
|
12
|
+
addGet;
|
|
13
|
+
addGetOffset;
|
|
12
14
|
constructor(addGet = false) {
|
|
13
15
|
this.addGet = addGet;
|
|
14
16
|
}
|
package/build/src/index.js
CHANGED
|
@@ -22,6 +22,7 @@ const handle_oa2p_1 = require("./handlers/handle_oa2p");
|
|
|
22
22
|
const handle_fugr_1 = require("./handlers/handle_fugr");
|
|
23
23
|
const initialization_1 = require("./initialization");
|
|
24
24
|
class Transpiler {
|
|
25
|
+
options;
|
|
25
26
|
constructor(options) {
|
|
26
27
|
this.options = options;
|
|
27
28
|
if (this.options === undefined) {
|
package/build/src/requires.js
CHANGED
|
@@ -6,10 +6,10 @@ const unique_identifier_1 = require("../unique_identifier");
|
|
|
6
6
|
const expressions_1 = require("../expressions");
|
|
7
7
|
const chunk_1 = require("../chunk");
|
|
8
8
|
class LoopTranspiler {
|
|
9
|
+
unique = "";
|
|
10
|
+
injectFrom = undefined;
|
|
11
|
+
skipInto = undefined;
|
|
9
12
|
constructor(options) {
|
|
10
|
-
this.unique = "";
|
|
11
|
-
this.injectFrom = undefined;
|
|
12
|
-
this.skipInto = undefined;
|
|
13
13
|
this.injectFrom = options?.injectFrom;
|
|
14
14
|
this.skipInto = options?.skipInto;
|
|
15
15
|
}
|
|
@@ -87,13 +87,14 @@ class LoopTranspiler {
|
|
|
87
87
|
const afterWhere = node.findExpressionAfterToken("WHERE");
|
|
88
88
|
if (afterWhere && afterWhere.get() instanceof abaplint.Expressions.Dynamic) {
|
|
89
89
|
const condition = afterWhere.findFirstExpression(abaplint.Expressions.FieldChain);
|
|
90
|
+
let code = "";
|
|
90
91
|
if (condition) {
|
|
91
|
-
|
|
92
|
-
extra.push(`dynamicWhere: {condition: ${code}, evaluate: (name) => {try { return eval(name);} catch {}}}`);
|
|
92
|
+
code = new expressions_1.FieldChainTranspiler(true).transpile(condition, traversal).getCode();
|
|
93
93
|
}
|
|
94
94
|
else {
|
|
95
|
-
|
|
95
|
+
code = `"transpiler, const dynamic loop where todo"`;
|
|
96
96
|
}
|
|
97
|
+
extra.push(`dynamicWhere: {condition: ${code}, evaluate: (name) => {try { return eval(name);} catch {}}}`);
|
|
97
98
|
}
|
|
98
99
|
const topEquals = {};
|
|
99
100
|
for (const compare of whereNode?.findDirectExpressions(abaplint.Expressions.ComponentCompare) || []) {
|
|
@@ -6,6 +6,7 @@ const expressions_1 = require("../expressions");
|
|
|
6
6
|
const chunk_1 = require("../chunk");
|
|
7
7
|
const unique_identifier_1 = require("../unique_identifier");
|
|
8
8
|
class WhileTranspiler {
|
|
9
|
+
syIndexBackup;
|
|
9
10
|
constructor(syIndexBackup) {
|
|
10
11
|
this.syIndexBackup = syIndexBackup;
|
|
11
12
|
}
|
package/build/src/traversal.js
CHANGED
|
@@ -11,8 +11,12 @@ const expressions_1 = require("./expressions");
|
|
|
11
11
|
const keywords_1 = require("./keywords");
|
|
12
12
|
const feature_flags_1 = require("./feature_flags");
|
|
13
13
|
class Traversal {
|
|
14
|
+
spaghetti;
|
|
15
|
+
file;
|
|
16
|
+
obj;
|
|
17
|
+
reg;
|
|
18
|
+
options;
|
|
14
19
|
constructor(spaghetti, file, obj, reg, options) {
|
|
15
|
-
this.scopeCache = undefined;
|
|
16
20
|
this.spaghetti = spaghetti;
|
|
17
21
|
this.file = file;
|
|
18
22
|
this.obj = obj;
|
|
@@ -68,6 +72,7 @@ class Traversal {
|
|
|
68
72
|
}
|
|
69
73
|
return undefined;
|
|
70
74
|
}
|
|
75
|
+
scopeCache = undefined;
|
|
71
76
|
findCurrentScopeByToken(token) {
|
|
72
77
|
const filename = this.file.getFilename();
|
|
73
78
|
if (this.scopeCache
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UniqueIdentifier = void 0;
|
|
4
4
|
class UniqueIdentifier {
|
|
5
|
+
static counter = 0;
|
|
6
|
+
static indexBackup = 0;
|
|
5
7
|
static reset() {
|
|
6
8
|
this.counter = 0;
|
|
7
9
|
}
|
|
@@ -23,6 +25,4 @@ class UniqueIdentifier {
|
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
exports.UniqueIdentifier = UniqueIdentifier;
|
|
26
|
-
UniqueIdentifier.counter = 0;
|
|
27
|
-
UniqueIdentifier.indexBackup = 0;
|
|
28
28
|
//# sourceMappingURL=unique_identifier.js.map
|
package/build/src/validation.js
CHANGED
|
@@ -105,6 +105,7 @@ exports.config = {
|
|
|
105
105
|
// todo, make sure nothing is overloaded, eg "lines()", there is a rule for this in abaplint now
|
|
106
106
|
// hmm this ^ is okay? since lines will be prefixed with "abap.builtin"?
|
|
107
107
|
class Validation {
|
|
108
|
+
options;
|
|
108
109
|
constructor(options) {
|
|
109
110
|
this.options = options;
|
|
110
111
|
}
|