@abaplint/core 2.95.28 → 2.95.29
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,7 +22,9 @@ class Data {
|
|
|
22
22
|
const found = new data_1.Data().runSyntax(c, scope, filename);
|
|
23
23
|
if (found) {
|
|
24
24
|
components.push({ name: found.getName(), type: found.getType() });
|
|
25
|
-
|
|
25
|
+
if (found.getValue() !== undefined) {
|
|
26
|
+
values[found.getName()] = found.getValue();
|
|
27
|
+
}
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
else if (c instanceof nodes_1.StructureNode && ctyp instanceof Structures.Data) {
|
|
@@ -77,7 +79,8 @@ class Data {
|
|
|
77
79
|
return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.TableType(new Basic.StructureType(components), { withHeader: true }));
|
|
78
80
|
}
|
|
79
81
|
else {
|
|
80
|
-
|
|
82
|
+
const val = Object.keys(values).length > 0 ? values : undefined;
|
|
83
|
+
return new _typed_identifier_1.TypedIdentifier(name, filename, new Basic.StructureType(components), undefined, val);
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
}
|
package/build/src/registry.js
CHANGED
|
@@ -406,6 +406,10 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
406
406
|
if (found) {
|
|
407
407
|
return found;
|
|
408
408
|
}
|
|
409
|
+
found = this.outlineGetReferenceSimple(high, lowFile);
|
|
410
|
+
if (found) {
|
|
411
|
+
return found;
|
|
412
|
+
}
|
|
409
413
|
found = this.outlineDataSimple(high, lowFile);
|
|
410
414
|
if (found) {
|
|
411
415
|
return found;
|
|
@@ -827,6 +831,28 @@ ${indentation}CATCH ${className} INTO ${targetName}.`;
|
|
|
827
831
|
const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), code);
|
|
828
832
|
return issue_1.Issue.atToken(lowFile, node.getFirstToken(), "Outline DATA", this.getMetadata().key, this.conf.severity, fix);
|
|
829
833
|
}
|
|
834
|
+
outlineGetReferenceSimple(node, lowFile) {
|
|
835
|
+
var _a, _b, _c;
|
|
836
|
+
if (!(node.get() instanceof Statements.GetReference)) {
|
|
837
|
+
return undefined;
|
|
838
|
+
}
|
|
839
|
+
const target = node.findFirstExpression(Expressions.Target);
|
|
840
|
+
if (!(((_a = target === null || target === void 0 ? void 0 : target.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.InlineData)) {
|
|
841
|
+
return undefined;
|
|
842
|
+
}
|
|
843
|
+
const source = node.findFirstExpression(Expressions.Source);
|
|
844
|
+
if (!(((_b = source === null || source === void 0 ? void 0 : source.getFirstChild()) === null || _b === void 0 ? void 0 : _b.get()) instanceof Expressions.FieldChain)) {
|
|
845
|
+
return undefined;
|
|
846
|
+
}
|
|
847
|
+
const targetName = ((_c = target.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || "errorError";
|
|
848
|
+
const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
|
|
849
|
+
const firstToken = target.getFirstToken();
|
|
850
|
+
const lastToken = target.getLastToken();
|
|
851
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getStart(), `DATA ${targetName} LIKE REF TO ${source.concatTokens()}.\n${indentation}`);
|
|
852
|
+
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), lastToken.getEnd(), targetName);
|
|
853
|
+
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
854
|
+
return issue_1.Issue.atToken(lowFile, node.getFirstToken(), "Outline DATA", this.getMetadata().key, this.conf.severity, fix);
|
|
855
|
+
}
|
|
830
856
|
outlineDataSimple(node, lowFile) {
|
|
831
857
|
// outlines "DATA(ls_msg) = temp1.", note that this does not need to look at types
|
|
832
858
|
var _a, _b, _c;
|