@abaplint/transpiler-cli 2.5.25 → 2.5.27
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 +90 -32
- package/package.json +3 -3
package/build/bundle.js
CHANGED
|
@@ -21633,29 +21633,81 @@ 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");
|
|
21638
21642
|
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") {
|
|
21643
|
+
runSyntax(context, node, scope, filename) {
|
|
21644
|
+
const children = node.getChildren();
|
|
21645
|
+
for (let i = 0; i < children.length; i++) {
|
|
21646
|
+
if (context instanceof void_type_1.VoidType || context instanceof basic_1.UnknownType) {
|
|
21646
21647
|
return context;
|
|
21647
21648
|
}
|
|
21648
|
-
|
|
21649
|
-
|
|
21650
|
-
|
|
21651
|
-
|
|
21652
|
-
|
|
21653
|
-
|
|
21654
|
-
|
|
21655
|
-
|
|
21649
|
+
const child = children[i];
|
|
21650
|
+
if (i === 0 && child.concatTokens().toUpperCase() === "TABLE_LINE") {
|
|
21651
|
+
continue;
|
|
21652
|
+
}
|
|
21653
|
+
else if (child.get() instanceof Expressions.ArrowOrDash) {
|
|
21654
|
+
const concat = child.concatTokens();
|
|
21655
|
+
if (concat === "-") {
|
|
21656
|
+
if (!(context instanceof structure_type_1.StructureType)) {
|
|
21657
|
+
throw new Error("ComponentChain, not a structure");
|
|
21658
|
+
}
|
|
21659
|
+
}
|
|
21660
|
+
else if (concat === "=>") {
|
|
21661
|
+
if (!(context instanceof basic_1.ObjectReferenceType)) {
|
|
21662
|
+
throw new Error("ComponentChain, not a reference");
|
|
21663
|
+
}
|
|
21664
|
+
}
|
|
21665
|
+
else if (concat === "->") {
|
|
21666
|
+
if (!(context instanceof basic_1.ObjectReferenceType) && !(context instanceof basic_1.DataReference)) {
|
|
21667
|
+
throw new Error("ComponentChain, not a reference");
|
|
21668
|
+
}
|
|
21669
|
+
}
|
|
21670
|
+
}
|
|
21671
|
+
else if (child.get() instanceof Expressions.ComponentName) {
|
|
21672
|
+
const name = child.concatTokens();
|
|
21673
|
+
if (context instanceof basic_1.DataReference) {
|
|
21674
|
+
context = context.getType();
|
|
21675
|
+
if (name === "*") {
|
|
21676
|
+
continue;
|
|
21677
|
+
}
|
|
21678
|
+
}
|
|
21679
|
+
if (context instanceof structure_type_1.StructureType) {
|
|
21680
|
+
context = context.getComponentByName(name);
|
|
21681
|
+
if (context === undefined) {
|
|
21682
|
+
throw new Error("Component \"" + name + "\" not found in structure");
|
|
21683
|
+
}
|
|
21684
|
+
}
|
|
21685
|
+
else if (context instanceof basic_1.ObjectReferenceType) {
|
|
21686
|
+
const id = context.getIdentifier();
|
|
21687
|
+
if (id instanceof types_1.InterfaceDefinition || id instanceof types_1.ClassDefinition) {
|
|
21688
|
+
const found = id.getAttributes().findByName(name);
|
|
21689
|
+
context = found === null || found === void 0 ? void 0 : found.getType();
|
|
21690
|
+
if (context === undefined) {
|
|
21691
|
+
throw new Error("Attribute \"" + name + "\" not found");
|
|
21692
|
+
}
|
|
21693
|
+
else {
|
|
21694
|
+
const extra = {
|
|
21695
|
+
ooName: id.getName(),
|
|
21696
|
+
ooType: id instanceof types_1.ClassDefinition ? "CLAS" : "INTF"
|
|
21697
|
+
};
|
|
21698
|
+
scope.addReference(child.getFirstToken(), found, _reference_1.ReferenceType.DataWriteReference, filename, extra);
|
|
21699
|
+
}
|
|
21700
|
+
}
|
|
21701
|
+
else {
|
|
21702
|
+
throw new Error("ComponentChain, unexpected type2");
|
|
21703
|
+
}
|
|
21704
|
+
}
|
|
21705
|
+
else {
|
|
21706
|
+
throw new Error("ComponentChain, not a structure");
|
|
21707
|
+
}
|
|
21708
|
+
}
|
|
21656
21709
|
}
|
|
21657
|
-
|
|
21658
|
-
return ret;
|
|
21710
|
+
return context;
|
|
21659
21711
|
}
|
|
21660
21712
|
}
|
|
21661
21713
|
exports.ComponentChain = ComponentChain;
|
|
@@ -21729,7 +21781,7 @@ class ComponentCompareSimple {
|
|
|
21729
21781
|
for (const c of node.getChildren()) {
|
|
21730
21782
|
if (c instanceof nodes_1.ExpressionNode) {
|
|
21731
21783
|
if (c.get() instanceof Expressions.ComponentChainSimple) {
|
|
21732
|
-
targetType = new component_chain_1.ComponentChain().runSyntax(rowType, c);
|
|
21784
|
+
targetType = new component_chain_1.ComponentChain().runSyntax(rowType, c, scope, filename);
|
|
21733
21785
|
}
|
|
21734
21786
|
else if (c.get() instanceof Expressions.Dynamic) {
|
|
21735
21787
|
targetType = undefined;
|
|
@@ -24163,7 +24215,7 @@ class Source {
|
|
|
24163
24215
|
// console.dir("dash");
|
|
24164
24216
|
}
|
|
24165
24217
|
else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.ComponentChain) {
|
|
24166
|
-
context = new component_chain_1.ComponentChain().runSyntax(context, first);
|
|
24218
|
+
context = new component_chain_1.ComponentChain().runSyntax(context, first, scope, filename);
|
|
24167
24219
|
}
|
|
24168
24220
|
else if (first instanceof nodes_1.ExpressionNode && first.get() instanceof Expressions.AttributeChain) {
|
|
24169
24221
|
context = new attribute_chain_1.AttributeChain().runSyntax(context, first, scope, filename, _reference_1.ReferenceType.DataReadReference);
|
|
@@ -46157,7 +46209,7 @@ class Registry {
|
|
|
46157
46209
|
}
|
|
46158
46210
|
static abaplintVersion() {
|
|
46159
46211
|
// magic, see build script "version.sh"
|
|
46160
|
-
return "2.95.
|
|
46212
|
+
return "2.95.36";
|
|
46161
46213
|
}
|
|
46162
46214
|
getDDICReferences() {
|
|
46163
46215
|
return this.references;
|
|
@@ -67409,13 +67461,20 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
67409
67461
|
exports.ComponentChainSimpleTranspiler = void 0;
|
|
67410
67462
|
const core_1 = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
67411
67463
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
67464
|
+
const traversal_1 = __webpack_require__(/*! ../traversal */ "./node_modules/@abaplint/transpiler/build/src/traversal.js");
|
|
67412
67465
|
class ComponentChainSimpleTranspiler {
|
|
67413
67466
|
transpile(node, traversal) {
|
|
67414
67467
|
const ret = new chunk_1.Chunk();
|
|
67415
67468
|
for (const c of node.getChildren()) {
|
|
67416
67469
|
const type = c.get();
|
|
67417
67470
|
if (type instanceof core_1.Expressions.ComponentName) {
|
|
67418
|
-
|
|
67471
|
+
let field = c.getFirstToken().getStr().toLowerCase();
|
|
67472
|
+
const interfaceName = traversal.isInterfaceAttribute(c.getFirstToken());
|
|
67473
|
+
if (interfaceName && field.startsWith(interfaceName) === false) {
|
|
67474
|
+
field = interfaceName + "$" + field;
|
|
67475
|
+
}
|
|
67476
|
+
field = traversal_1.Traversal.escapeNamespace(field).replace("~", "$");
|
|
67477
|
+
ret.append(field, c, traversal);
|
|
67419
67478
|
}
|
|
67420
67479
|
else if (type instanceof core_1.Expressions.ArrowOrDash) {
|
|
67421
67480
|
ret.append(".get().", c, traversal);
|
|
@@ -73538,10 +73597,14 @@ class MethodImplementationTranspiler {
|
|
|
73538
73597
|
}
|
|
73539
73598
|
after = after + new transpile_types_1.TranspileTypes().declare(identifier) + "\n";
|
|
73540
73599
|
const type = identifier.getType();
|
|
73541
|
-
|
|
73600
|
+
// todo, type X is also generic in method definitions, the real fix will be in abaplint
|
|
73601
|
+
const charGeneric = type instanceof abaplint.BasicTypes.CharacterType
|
|
73602
|
+
&& type.getLength() === 1
|
|
73603
|
+
&& type.getDDICName() === undefined
|
|
73604
|
+
&& type.getQualifiedName() === undefined;
|
|
73542
73605
|
if (identifier.getMeta().includes("importing" /* abaplint.IdentifierMeta.MethodImporting */)
|
|
73543
73606
|
&& type.isGeneric() === false
|
|
73544
|
-
&&
|
|
73607
|
+
&& charGeneric === false) {
|
|
73545
73608
|
after += "if (" + unique + " && " + unique + "." + varName + ") {" + varName + ".set(" + unique + "." + varName + ");}\n";
|
|
73546
73609
|
}
|
|
73547
73610
|
else {
|
|
@@ -74093,7 +74156,6 @@ exports.ReadReportTranspiler = ReadReportTranspiler;
|
|
|
74093
74156
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
74094
74157
|
exports.ReadTableTranspiler = void 0;
|
|
74095
74158
|
const abaplint = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
74096
|
-
const traversal_1 = __webpack_require__(/*! ../traversal */ "./node_modules/@abaplint/transpiler/build/src/traversal.js");
|
|
74097
74159
|
const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/@abaplint/transpiler/build/src/expressions/index.js");
|
|
74098
74160
|
const unique_identifier_1 = __webpack_require__(/*! ../unique_identifier */ "./node_modules/@abaplint/transpiler/build/src/unique_identifier.js");
|
|
74099
74161
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
@@ -74146,19 +74208,15 @@ class ReadTableTranspiler {
|
|
|
74146
74208
|
const left = compare.getChildren()[i * 3];
|
|
74147
74209
|
const source = compare.getChildren()[(i * 3) + 2];
|
|
74148
74210
|
const s = traversal.traverse(source).getCode();
|
|
74149
|
-
let field =
|
|
74150
|
-
while (field.includes("->")) {
|
|
74151
|
-
field = field.replace("->", ".get().");
|
|
74152
|
-
}
|
|
74153
|
-
while (field.includes("-")) {
|
|
74154
|
-
field = field.replace("-", ".get().");
|
|
74155
|
-
}
|
|
74156
|
-
field = traversal_1.Traversal.escapeNamespace(field).replace("~", "$");
|
|
74211
|
+
let field = "";
|
|
74157
74212
|
if (left.get() instanceof abaplint.Expressions.Dynamic
|
|
74158
74213
|
&& left instanceof abaplint.Nodes.ExpressionNode) {
|
|
74159
74214
|
const concat = left.concatTokens().toLowerCase();
|
|
74160
74215
|
field = concat.substring(2, concat.length - 2);
|
|
74161
74216
|
}
|
|
74217
|
+
else {
|
|
74218
|
+
field = traversal.traverse(left).getCode();
|
|
74219
|
+
}
|
|
74162
74220
|
if (s.includes("await")) {
|
|
74163
74221
|
const id = unique_identifier_1.UniqueIdentifier.get();
|
|
74164
74222
|
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.27",
|
|
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.27",
|
|
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.36",
|
|
33
33
|
"progress": "^2.0.3",
|
|
34
34
|
"webpack": "^5.76.0",
|
|
35
35
|
"webpack-cli": "^5.0.1",
|