@abaplint/transpiler-cli 2.5.13 → 2.5.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.
- package/build/bundle.js +40 -6
- package/package.json +3 -3
package/build/bundle.js
CHANGED
|
@@ -29930,7 +29930,9 @@ class Data {
|
|
|
29930
29930
|
const found = new data_1.Data().runSyntax(c, scope, filename);
|
|
29931
29931
|
if (found) {
|
|
29932
29932
|
components.push({ name: found.getName(), type: found.getType() });
|
|
29933
|
-
|
|
29933
|
+
if (found.getValue() !== undefined) {
|
|
29934
|
+
values[found.getName()] = found.getValue();
|
|
29935
|
+
}
|
|
29934
29936
|
}
|
|
29935
29937
|
}
|
|
29936
29938
|
else if (c instanceof nodes_1.StructureNode && ctyp instanceof Structures.Data) {
|
|
@@ -29985,7 +29987,8 @@ class Data {
|
|
|
29985
29987
|
return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.TableType(new Basic.StructureType(components), { withHeader: true }));
|
|
29986
29988
|
}
|
|
29987
29989
|
else {
|
|
29988
|
-
|
|
29990
|
+
const val = Object.keys(values).length > 0 ? values : undefined;
|
|
29991
|
+
return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.StructureType(components), undefined, val);
|
|
29989
29992
|
}
|
|
29990
29993
|
}
|
|
29991
29994
|
}
|
|
@@ -46135,7 +46138,7 @@ class Registry {
|
|
|
46135
46138
|
}
|
|
46136
46139
|
static abaplintVersion() {
|
|
46137
46140
|
// magic, see build script "version.sh"
|
|
46138
|
-
return "2.95.
|
|
46141
|
+
return "2.95.29";
|
|
46139
46142
|
}
|
|
46140
46143
|
getDDICReferences() {
|
|
46141
46144
|
return this.references;
|
|
@@ -51078,6 +51081,10 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
51078
51081
|
if (found) {
|
|
51079
51082
|
return found;
|
|
51080
51083
|
}
|
|
51084
|
+
found = this.outlineGetReferenceSimple(high, lowFile);
|
|
51085
|
+
if (found) {
|
|
51086
|
+
return found;
|
|
51087
|
+
}
|
|
51081
51088
|
found = this.outlineDataSimple(high, lowFile);
|
|
51082
51089
|
if (found) {
|
|
51083
51090
|
return found;
|
|
@@ -51499,6 +51506,28 @@ ${indentation}CATCH ${className} INTO ${targetName}.`;
|
|
|
51499
51506
|
const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), code);
|
|
51500
51507
|
return issue_1.Issue.atToken(lowFile, node.getFirstToken(), "Outline DATA", this.getMetadata().key, this.conf.severity, fix);
|
|
51501
51508
|
}
|
|
51509
|
+
outlineGetReferenceSimple(node, lowFile) {
|
|
51510
|
+
var _a, _b, _c;
|
|
51511
|
+
if (!(node.get() instanceof Statements.GetReference)) {
|
|
51512
|
+
return undefined;
|
|
51513
|
+
}
|
|
51514
|
+
const target = node.findFirstExpression(Expressions.Target);
|
|
51515
|
+
if (!(((_a = target === null || target === void 0 ? void 0 : target.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.InlineData)) {
|
|
51516
|
+
return undefined;
|
|
51517
|
+
}
|
|
51518
|
+
const source = node.findFirstExpression(Expressions.Source);
|
|
51519
|
+
if (!(((_b = source === null || source === void 0 ? void 0 : source.getFirstChild()) === null || _b === void 0 ? void 0 : _b.get()) instanceof Expressions.FieldChain)) {
|
|
51520
|
+
return undefined;
|
|
51521
|
+
}
|
|
51522
|
+
const targetName = ((_c = target.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || "errorError";
|
|
51523
|
+
const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
|
|
51524
|
+
const firstToken = target.getFirstToken();
|
|
51525
|
+
const lastToken = target.getLastToken();
|
|
51526
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getStart(), `DATA ${targetName} LIKE REF TO ${source.concatTokens()}.\n${indentation}`);
|
|
51527
|
+
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), lastToken.getEnd(), targetName);
|
|
51528
|
+
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
51529
|
+
return issue_1.Issue.atToken(lowFile, node.getFirstToken(), "Outline DATA", this.getMetadata().key, this.conf.severity, fix);
|
|
51530
|
+
}
|
|
51502
51531
|
outlineDataSimple(node, lowFile) {
|
|
51503
51532
|
// outlines "DATA(ls_msg) = temp1.", note that this does not need to look at types
|
|
51504
51533
|
var _a, _b, _c;
|
|
@@ -67731,9 +67760,10 @@ class FieldChainTranspiler {
|
|
|
67731
67760
|
constructor(addGet = false) {
|
|
67732
67761
|
this.addGet = addGet;
|
|
67733
67762
|
}
|
|
67734
|
-
transpile(node, traversal, prefix = true, filename) {
|
|
67763
|
+
transpile(node, traversal, prefix = true, filename, wrongScope = false) {
|
|
67735
67764
|
const ret = new chunk_1.Chunk();
|
|
67736
67765
|
const extra = [];
|
|
67766
|
+
let interfaceNameAdded = false;
|
|
67737
67767
|
for (const c of node.getChildren()) {
|
|
67738
67768
|
if (c.get() instanceof core_1.Expressions.SourceField
|
|
67739
67769
|
|| c.get() instanceof core_1.Expressions.Field) {
|
|
@@ -67746,11 +67776,15 @@ class FieldChainTranspiler {
|
|
|
67746
67776
|
else if (c instanceof core_1.Nodes.ExpressionNode && c.get() instanceof core_1.Expressions.ClassName) {
|
|
67747
67777
|
const name = traversal.lookupClassOrInterface(c.getFirstToken().getStr(), c.getFirstToken());
|
|
67748
67778
|
ret.append(name + ".", c, traversal);
|
|
67779
|
+
if (wrongScope === true && traversal.reg.getObject("INTF", c.getFirstToken().getStr())) {
|
|
67780
|
+
ret.append(traversal_1.Traversal.escapeNamespace(c.getFirstToken().getStr().toLocaleLowerCase()) + "$", c, traversal);
|
|
67781
|
+
interfaceNameAdded = true;
|
|
67782
|
+
}
|
|
67749
67783
|
}
|
|
67750
67784
|
else if (c.get() instanceof core_1.Expressions.AttributeName) {
|
|
67751
67785
|
const interfaceName = traversal.isInterfaceAttribute(c.getFirstToken());
|
|
67752
67786
|
let name = c.getFirstToken().getStr().toLowerCase();
|
|
67753
|
-
if (prefix && interfaceName && name.startsWith(interfaceName) === false) {
|
|
67787
|
+
if (prefix && interfaceName && name.startsWith(interfaceName) === false && interfaceNameAdded === false) {
|
|
67754
67788
|
name = traversal_1.Traversal.escapeNamespace(name).replace("~", "$");
|
|
67755
67789
|
name = traversal_1.Traversal.escapeNamespace(interfaceName) + "$" + name;
|
|
67756
67790
|
}
|
|
@@ -73463,7 +73497,7 @@ class MethodImplementationTranspiler {
|
|
|
73463
73497
|
}
|
|
73464
73498
|
else {
|
|
73465
73499
|
// note: this can be difficult, the "def" might be from an interface, ie. a different scope than the method
|
|
73466
|
-
val = new expressions_1.FieldChainTranspiler().transpile(parameterDefault, traversal, true, methodDef === null || methodDef === void 0 ? void 0 : methodDef.getFilename()).getCode();
|
|
73500
|
+
val = new expressions_1.FieldChainTranspiler().transpile(parameterDefault, traversal, true, methodDef === null || methodDef === void 0 ? void 0 : methodDef.getFilename(), true).getCode();
|
|
73467
73501
|
if (val.startsWith(parameterDefault.getFirstToken().getStr().toLowerCase()) === true) {
|
|
73468
73502
|
val = "this." + val;
|
|
73469
73503
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.15",
|
|
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.15",
|
|
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.29",
|
|
33
33
|
"progress": "^2.0.3",
|
|
34
34
|
"webpack": "^5.75.0",
|
|
35
35
|
"webpack-cli": "^5.0.1",
|