@abaplint/transpiler-cli 2.5.26 → 2.5.28
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/bundle.js +85 -30
- package/package.json +3 -3
package/build/bundle.js
CHANGED
|
@@ -21633,29 +21633,82 @@ exports.Compare = Compare;
|
|
|
21633
21633
|
|
|
21634
21634
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
21635
21635
|
exports.ComponentChain = void 0;
|
|
21636
|
+
const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
|
|
21636
21637
|
const void_type_1 = __webpack_require__(/*! ../../types/basic/void_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/void_type.js");
|
|
21637
21638
|
const structure_type_1 = __webpack_require__(/*! ../../types/basic/structure_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/structure_type.js");
|
|
21639
|
+
const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
|
|
21640
|
+
const types_1 = __webpack_require__(/*! ../../types */ "./node_modules/@abaplint/core/build/src/abap/types/index.js");
|
|
21641
|
+
const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
|
|
21642
|
+
const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js");
|
|
21638
21643
|
class ComponentChain {
|
|
21639
|
-
runSyntax(context, node) {
|
|
21640
|
-
|
|
21641
|
-
|
|
21642
|
-
|
|
21643
|
-
const name = node.getFirstToken().getStr();
|
|
21644
|
-
if (!(context instanceof structure_type_1.StructureType)) {
|
|
21645
|
-
if (name.toUpperCase() === "TABLE_LINE") {
|
|
21644
|
+
runSyntax(context, node, scope, filename) {
|
|
21645
|
+
const children = node.getChildren();
|
|
21646
|
+
for (let i = 0; i < children.length; i++) {
|
|
21647
|
+
if (context instanceof void_type_1.VoidType || context instanceof basic_1.UnknownType) {
|
|
21646
21648
|
return context;
|
|
21647
21649
|
}
|
|
21648
|
-
|
|
21649
|
-
|
|
21650
|
-
|
|
21651
|
-
|
|
21652
|
-
|
|
21653
|
-
|
|
21654
|
-
|
|
21655
|
-
|
|
21650
|
+
const child = children[i];
|
|
21651
|
+
if (i === 0 && child.concatTokens().toUpperCase() === "TABLE_LINE") {
|
|
21652
|
+
continue;
|
|
21653
|
+
}
|
|
21654
|
+
else if (child.get() instanceof Expressions.ArrowOrDash) {
|
|
21655
|
+
const concat = child.concatTokens();
|
|
21656
|
+
if (concat === "-") {
|
|
21657
|
+
if (!(context instanceof structure_type_1.StructureType)) {
|
|
21658
|
+
throw new Error("ComponentChain, not a structure");
|
|
21659
|
+
}
|
|
21660
|
+
}
|
|
21661
|
+
else if (concat === "=>") {
|
|
21662
|
+
if (!(context instanceof basic_1.ObjectReferenceType)) {
|
|
21663
|
+
throw new Error("ComponentChain, not a reference");
|
|
21664
|
+
}
|
|
21665
|
+
}
|
|
21666
|
+
else if (concat === "->") {
|
|
21667
|
+
if (!(context instanceof basic_1.ObjectReferenceType) && !(context instanceof basic_1.DataReference)) {
|
|
21668
|
+
throw new Error("ComponentChain, not a reference");
|
|
21669
|
+
}
|
|
21670
|
+
}
|
|
21671
|
+
}
|
|
21672
|
+
else if (child.get() instanceof Expressions.ComponentName) {
|
|
21673
|
+
const name = child.concatTokens();
|
|
21674
|
+
if (context instanceof basic_1.DataReference) {
|
|
21675
|
+
context = context.getType();
|
|
21676
|
+
if (name === "*") {
|
|
21677
|
+
continue;
|
|
21678
|
+
}
|
|
21679
|
+
}
|
|
21680
|
+
if (context instanceof structure_type_1.StructureType) {
|
|
21681
|
+
context = context.getComponentByName(name);
|
|
21682
|
+
if (context === undefined) {
|
|
21683
|
+
throw new Error("Component \"" + name + "\" not found in structure");
|
|
21684
|
+
}
|
|
21685
|
+
}
|
|
21686
|
+
else if (context instanceof basic_1.ObjectReferenceType) {
|
|
21687
|
+
const id = context.getIdentifier();
|
|
21688
|
+
const def = scope.findObjectDefinition(id.getName());
|
|
21689
|
+
if (def === undefined) {
|
|
21690
|
+
throw new Error(id.getName() + " not found in scope");
|
|
21691
|
+
}
|
|
21692
|
+
const helper = new _object_oriented_1.ObjectOriented(scope);
|
|
21693
|
+
const found = helper.searchAttributeName(def, name);
|
|
21694
|
+
context = found === null || found === void 0 ? void 0 : found.getType();
|
|
21695
|
+
if (context === undefined) {
|
|
21696
|
+
throw new Error("Attribute \"" + name + "\" not found");
|
|
21697
|
+
}
|
|
21698
|
+
else {
|
|
21699
|
+
const extra = {
|
|
21700
|
+
ooName: id.getName(),
|
|
21701
|
+
ooType: id instanceof types_1.ClassDefinition ? "CLAS" : "INTF"
|
|
21702
|
+
};
|
|
21703
|
+
scope.addReference(child.getFirstToken(), found, _reference_1.ReferenceType.DataWriteReference, filename, extra);
|
|
21704
|
+
}
|
|
21705
|
+
}
|
|
21706
|
+
else {
|
|
21707
|
+
throw new Error("ComponentChain, not a structure");
|
|
21708
|
+
}
|
|
21709
|
+
}
|
|
21656
21710
|
}
|
|
21657
|
-
|
|
21658
|
-
return ret;
|
|
21711
|
+
return context;
|
|
21659
21712
|
}
|
|
21660
21713
|
}
|
|
21661
21714
|
exports.ComponentChain = ComponentChain;
|
|
@@ -21729,7 +21782,7 @@ class ComponentCompareSimple {
|
|
|
21729
21782
|
for (const c of node.getChildren()) {
|
|
21730
21783
|
if (c instanceof nodes_1.ExpressionNode) {
|
|
21731
21784
|
if (c.get() instanceof Expressions.ComponentChainSimple) {
|
|
21732
|
-
targetType = new component_chain_1.ComponentChain().runSyntax(rowType, c);
|
|
21785
|
+
targetType = new component_chain_1.ComponentChain().runSyntax(rowType, c, scope, filename);
|
|
21733
21786
|
}
|
|
21734
21787
|
else if (c.get() instanceof Expressions.Dynamic) {
|
|
21735
21788
|
targetType = undefined;
|
|
@@ -24163,7 +24216,7 @@ class Source {
|
|
|
24163
24216
|
// console.dir("dash");
|
|
24164
24217
|
}
|
|
24165
24218
|
else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.ComponentChain) {
|
|
24166
|
-
context = new component_chain_1.ComponentChain().runSyntax(context, first);
|
|
24219
|
+
context = new component_chain_1.ComponentChain().runSyntax(context, first, scope, filename);
|
|
24167
24220
|
}
|
|
24168
24221
|
else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.AttributeChain) {
|
|
24169
24222
|
context = new attribute_chain_1.AttributeChain().runSyntax(context, first, scope, filename, _reference_1.ReferenceType.DataReadReference);
|
|
@@ -46157,7 +46210,7 @@ class Registry {
|
|
|
46157
46210
|
}
|
|
46158
46211
|
static abaplintVersion() {
|
|
46159
46212
|
// magic, see build script "version.sh"
|
|
46160
|
-
return "2.95.
|
|
46213
|
+
return "2.95.38";
|
|
46161
46214
|
}
|
|
46162
46215
|
getDDICReferences() {
|
|
46163
46216
|
return this.references;
|
|
@@ -67409,13 +67462,20 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
67409
67462
|
exports.ComponentChainSimpleTranspiler = void 0;
|
|
67410
67463
|
const core_1 = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
67411
67464
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
67465
|
+
const traversal_1 = __webpack_require__(/*! ../traversal */ "./node_modules/@abaplint/transpiler/build/src/traversal.js");
|
|
67412
67466
|
class ComponentChainSimpleTranspiler {
|
|
67413
67467
|
transpile(node, traversal) {
|
|
67414
67468
|
const ret = new chunk_1.Chunk();
|
|
67415
67469
|
for (const c of node.getChildren()) {
|
|
67416
67470
|
const type = c.get();
|
|
67417
67471
|
if (type instanceof core_1.Expressions.ComponentName) {
|
|
67418
|
-
|
|
67472
|
+
let field = c.getFirstToken().getStr().toLowerCase();
|
|
67473
|
+
const interfaceName = traversal.isInterfaceAttribute(c.getFirstToken());
|
|
67474
|
+
if (interfaceName && field.startsWith(interfaceName) === false) {
|
|
67475
|
+
field = interfaceName + "$" + field;
|
|
67476
|
+
}
|
|
67477
|
+
field = traversal_1.Traversal.escapeNamespace(field).replace("~", "$");
|
|
67478
|
+
ret.append(field, c, traversal);
|
|
67419
67479
|
}
|
|
67420
67480
|
else if (type instanceof core_1.Expressions.ArrowOrDash) {
|
|
67421
67481
|
ret.append(".get().", c, traversal);
|
|
@@ -74097,7 +74157,6 @@ exports.ReadReportTranspiler = ReadReportTranspiler;
|
|
|
74097
74157
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
74098
74158
|
exports.ReadTableTranspiler = void 0;
|
|
74099
74159
|
const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
74100
|
-
const traversal_1 = __webpack_require__(/*! ../traversal */ "./node_modules/@abaplint/transpiler/build/src/traversal.js");
|
|
74101
74160
|
const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/@abaplint/transpiler/build/src/expressions/index.js");
|
|
74102
74161
|
const unique_identifier_1 = __webpack_require__(/*! ../unique_identifier */ "./node_modules/@abaplint/transpiler/build/src/unique_identifier.js");
|
|
74103
74162
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
@@ -74150,19 +74209,15 @@ class ReadTableTranspiler {
|
|
|
74150
74209
|
const left = compare.getChildren()[i * 3];
|
|
74151
74210
|
const source = compare.getChildren()[(i * 3) + 2];
|
|
74152
74211
|
const s = traversal.traverse(source).getCode();
|
|
74153
|
-
let field =
|
|
74154
|
-
while (field.includes("->")) {
|
|
74155
|
-
field = field.replace("->", ".get().");
|
|
74156
|
-
}
|
|
74157
|
-
while (field.includes("-")) {
|
|
74158
|
-
field = field.replace("-", ".get().");
|
|
74159
|
-
}
|
|
74160
|
-
field = traversal_1.Traversal.escapeNamespace(field).replace("~", "$");
|
|
74212
|
+
let field = "";
|
|
74161
74213
|
if (left.get() instanceof abaplint.Expressions.Dynamic
|
|
74162
74214
|
&& left instanceof abaplint.Nodes.ExpressionNode) {
|
|
74163
74215
|
const concat = left.concatTokens().toLowerCase();
|
|
74164
74216
|
field = concat.substring(2, concat.length - 2);
|
|
74165
74217
|
}
|
|
74218
|
+
else {
|
|
74219
|
+
field = traversal.traverse(left).getCode();
|
|
74220
|
+
}
|
|
74166
74221
|
if (s.includes("await")) {
|
|
74167
74222
|
const id = unique_identifier_1.UniqueIdentifier.get();
|
|
74168
74223
|
prefix += "const " + id + " = " + s + ";\n";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.28",
|
|
4
4
|
"description": "Transpiler - Command Line Interface",
|
|
5
5
|
"bin": {
|
|
6
6
|
"abap_transpile": "./abap_transpile"
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"author": "abaplint",
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@abaplint/transpiler": "^2.5.
|
|
28
|
+
"@abaplint/transpiler": "^2.5.28",
|
|
29
29
|
"@types/glob": "^7.2.0",
|
|
30
30
|
"glob": "=7.2.0",
|
|
31
31
|
"@types/progress": "^2.0.5",
|
|
32
|
-
"@abaplint/core": "^2.95.
|
|
32
|
+
"@abaplint/core": "^2.95.38",
|
|
33
33
|
"progress": "^2.0.3",
|
|
34
34
|
"webpack": "^5.76.0",
|
|
35
35
|
"webpack-cli": "^5.0.1",
|