@abaplint/transpiler-cli 2.13.80 → 2.13.82
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 +158 -29
- package/package.json +3 -3
package/build/bundle.js
CHANGED
|
@@ -36816,6 +36816,19 @@ class ValueBody {
|
|
|
36816
36816
|
const message = "VALUE, source type CharacterType not compatible with StringType";
|
|
36817
36817
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, s.getFirstToken(), message));
|
|
36818
36818
|
}
|
|
36819
|
+
else if (this.insertsUsingTableKey(targetType)) {
|
|
36820
|
+
// only STANDARD tables append the rows, and thus allow padding of shorter c and x values
|
|
36821
|
+
const row = this.characterOrHexLength(rowType);
|
|
36822
|
+
const source = this.characterOrHexLength(sourceType);
|
|
36823
|
+
if (row !== undefined
|
|
36824
|
+
&& source !== undefined
|
|
36825
|
+
&& row.abap === source.abap
|
|
36826
|
+
&& row.length !== source.length) {
|
|
36827
|
+
const message = `VALUE, source type ${source.abap} LENGTH ${source.length} not compatible ` +
|
|
36828
|
+
`with row type ${row.abap} LENGTH ${row.length}`;
|
|
36829
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, s.getFirstToken(), message));
|
|
36830
|
+
}
|
|
36831
|
+
}
|
|
36819
36832
|
}
|
|
36820
36833
|
}
|
|
36821
36834
|
if (letScoped === true) {
|
|
@@ -36829,6 +36842,25 @@ class ValueBody {
|
|
|
36829
36842
|
}
|
|
36830
36843
|
return targetType ? targetType : type;
|
|
36831
36844
|
}
|
|
36845
|
+
/** SORTED and HASHED tables insert the constructed rows using the table key, which
|
|
36846
|
+
* requires the rows to be compatible with the row type. STANDARD tables only append
|
|
36847
|
+
* the rows, so shorter c and x values are padded on the right instead. */
|
|
36848
|
+
static insertsUsingTableKey(targetType) {
|
|
36849
|
+
if (!(targetType instanceof basic_1.TableType)) {
|
|
36850
|
+
return false;
|
|
36851
|
+
}
|
|
36852
|
+
const accessType = targetType.getAccessType();
|
|
36853
|
+
return accessType === basic_1.TableAccessType.sorted || accessType === basic_1.TableAccessType.hashed;
|
|
36854
|
+
}
|
|
36855
|
+
static characterOrHexLength(type) {
|
|
36856
|
+
if (type instanceof basic_1.CharacterType) {
|
|
36857
|
+
return { abap: "c", length: type.getLength() };
|
|
36858
|
+
}
|
|
36859
|
+
else if (type instanceof basic_1.HexType) {
|
|
36860
|
+
return { abap: "x", length: type.getLength() };
|
|
36861
|
+
}
|
|
36862
|
+
return undefined;
|
|
36863
|
+
}
|
|
36832
36864
|
}
|
|
36833
36865
|
exports.ValueBody = ValueBody;
|
|
36834
36866
|
//# sourceMappingURL=value_body.js.map
|
|
@@ -69148,6 +69180,20 @@ class Table extends _abstract_object_1.AbstractObject {
|
|
|
69148
69180
|
}
|
|
69149
69181
|
return (_a = this.parsedData) === null || _a === void 0 ? void 0 : _a.tableCategory;
|
|
69150
69182
|
}
|
|
69183
|
+
getDeliveryClass() {
|
|
69184
|
+
var _a;
|
|
69185
|
+
if (this.parsedData === undefined) {
|
|
69186
|
+
this.parseXML();
|
|
69187
|
+
}
|
|
69188
|
+
return (_a = this.parsedData) === null || _a === void 0 ? void 0 : _a.deliveryClass;
|
|
69189
|
+
}
|
|
69190
|
+
getSizeCategory() {
|
|
69191
|
+
var _a;
|
|
69192
|
+
if (this.parsedData === undefined) {
|
|
69193
|
+
this.parseXML();
|
|
69194
|
+
}
|
|
69195
|
+
return (_a = this.parsedData) === null || _a === void 0 ? void 0 : _a.sizeCategory;
|
|
69196
|
+
}
|
|
69151
69197
|
getEnhancementCategory() {
|
|
69152
69198
|
var _a;
|
|
69153
69199
|
if (this.parsedData === undefined) {
|
|
@@ -69175,7 +69221,7 @@ class Table extends _abstract_object_1.AbstractObject {
|
|
|
69175
69221
|
return false;
|
|
69176
69222
|
}
|
|
69177
69223
|
parseXML() {
|
|
69178
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
|
|
69224
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12;
|
|
69179
69225
|
const parsed = super.parseRaw2();
|
|
69180
69226
|
if (parsed === undefined) {
|
|
69181
69227
|
return;
|
|
@@ -69195,8 +69241,10 @@ class Table extends _abstract_object_1.AbstractObject {
|
|
|
69195
69241
|
this.parsedData.tableCategory = (_m = (_l = (_k = (_j = parsed === null || parsed === void 0 ? void 0 : parsed.abapGit) === null || _j === void 0 ? void 0 : _j["asx:abap"]) === null || _k === void 0 ? void 0 : _k["asx:values"]) === null || _l === void 0 ? void 0 : _l.DD02V) === null || _m === void 0 ? void 0 : _m.TABCLASS;
|
|
69196
69242
|
this.parsedData.description = (_r = (_q = (_p = (_o = parsed === null || parsed === void 0 ? void 0 : parsed.abapGit) === null || _o === void 0 ? void 0 : _o["asx:abap"]) === null || _p === void 0 ? void 0 : _p["asx:values"]) === null || _q === void 0 ? void 0 : _q.DD02V) === null || _r === void 0 ? void 0 : _r.DDTEXT;
|
|
69197
69243
|
this.parsedData.dataClass = (_v = (_u = (_t = (_s = parsed === null || parsed === void 0 ? void 0 : parsed.abapGit) === null || _s === void 0 ? void 0 : _s["asx:abap"]) === null || _t === void 0 ? void 0 : _t["asx:values"]) === null || _u === void 0 ? void 0 : _u.DD09L) === null || _v === void 0 ? void 0 : _v.TABART;
|
|
69244
|
+
this.parsedData.deliveryClass = (_z = (_y = (_x = (_w = parsed === null || parsed === void 0 ? void 0 : parsed.abapGit) === null || _w === void 0 ? void 0 : _w["asx:abap"]) === null || _x === void 0 ? void 0 : _x["asx:values"]) === null || _y === void 0 ? void 0 : _y.DD02V) === null || _z === void 0 ? void 0 : _z.CONTFLAG;
|
|
69245
|
+
this.parsedData.sizeCategory = (_3 = (_2 = (_1 = (_0 = parsed === null || parsed === void 0 ? void 0 : parsed.abapGit) === null || _0 === void 0 ? void 0 : _0["asx:abap"]) === null || _1 === void 0 ? void 0 : _1["asx:values"]) === null || _2 === void 0 ? void 0 : _2.DD09L) === null || _3 === void 0 ? void 0 : _3.TABKAT;
|
|
69198
69246
|
// fields
|
|
69199
|
-
const fields = (
|
|
69247
|
+
const fields = (_6 = (_5 = (_4 = parsed === null || parsed === void 0 ? void 0 : parsed.abapGit) === null || _4 === void 0 ? void 0 : _4["asx:abap"]) === null || _5 === void 0 ? void 0 : _5["asx:values"]) === null || _6 === void 0 ? void 0 : _6.DD03P_TABLE;
|
|
69200
69248
|
for (const field of (0, xml_utils_1.xmlToArray)(fields === null || fields === void 0 ? void 0 : fields.DD03P)) {
|
|
69201
69249
|
if (typeof (field === null || field === void 0 ? void 0 : field.FIELDNAME) !== "string") {
|
|
69202
69250
|
continue;
|
|
@@ -69220,13 +69268,13 @@ class Table extends _abstract_object_1.AbstractObject {
|
|
|
69220
69268
|
});
|
|
69221
69269
|
}
|
|
69222
69270
|
// secondary indexes
|
|
69223
|
-
const indexes = (
|
|
69271
|
+
const indexes = (_9 = (_8 = (_7 = parsed === null || parsed === void 0 ? void 0 : parsed.abapGit) === null || _7 === void 0 ? void 0 : _7["asx:abap"]) === null || _8 === void 0 ? void 0 : _8["asx:values"]) === null || _9 === void 0 ? void 0 : _9.DD12V;
|
|
69224
69272
|
;
|
|
69225
69273
|
this.parsedData.secondaryIndexes = [];
|
|
69226
69274
|
for (const index of (0, xml_utils_1.xmlToArray)(indexes === null || indexes === void 0 ? void 0 : indexes.DD12V)) {
|
|
69227
69275
|
const indexName = index.INDEXNAME;
|
|
69228
69276
|
const indexFields = [];
|
|
69229
|
-
const indexFieldsXml = (
|
|
69277
|
+
const indexFieldsXml = (_12 = (_11 = (_10 = parsed === null || parsed === void 0 ? void 0 : parsed.abapGit) === null || _10 === void 0 ? void 0 : _10["asx:abap"]) === null || _11 === void 0 ? void 0 : _11["asx:values"]) === null || _12 === void 0 ? void 0 : _12.DD17V;
|
|
69230
69278
|
for (const indexField of (0, xml_utils_1.xmlToArray)(indexFieldsXml === null || indexFieldsXml === void 0 ? void 0 : indexFieldsXml.DD17V)) {
|
|
69231
69279
|
if (indexField.INDEXNAME === indexName) {
|
|
69232
69280
|
// assumption: fields are listed by POSITION in the xml
|
|
@@ -70764,7 +70812,7 @@ class Registry {
|
|
|
70764
70812
|
}
|
|
70765
70813
|
static abaplintVersion() {
|
|
70766
70814
|
// magic, see build script "version.js"
|
|
70767
|
-
return "2.120.
|
|
70815
|
+
return "2.120.45";
|
|
70768
70816
|
}
|
|
70769
70817
|
getDDICReferences() {
|
|
70770
70818
|
return this.ddicReferences;
|
|
@@ -86137,6 +86185,7 @@ exports.LineBreakStyle = exports.LineBreakStyleConf = void 0;
|
|
|
86137
86185
|
const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
|
|
86138
86186
|
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
|
|
86139
86187
|
const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
|
|
86188
|
+
const objects_1 = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
|
|
86140
86189
|
class LineBreakStyleConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
86141
86190
|
}
|
|
86142
86191
|
exports.LineBreakStyleConf = LineBreakStyleConf;
|
|
@@ -86147,10 +86196,11 @@ class LineBreakStyle {
|
|
|
86147
86196
|
getMetadata() {
|
|
86148
86197
|
return {
|
|
86149
86198
|
key: "line_break_style",
|
|
86150
|
-
title: "Makes sure line breaks are consistent
|
|
86151
|
-
shortDescription: `Enforces LF as newlines in ABAP files
|
|
86199
|
+
title: "Makes sure line breaks are consistent",
|
|
86200
|
+
shortDescription: `Enforces LF as newlines in ABAP and XML files
|
|
86152
86201
|
|
|
86153
86202
|
abapGit does not work with CRLF`,
|
|
86203
|
+
extendedInformation: `SMIM and W3MI files are not checked.`,
|
|
86154
86204
|
tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.SingleFile],
|
|
86155
86205
|
};
|
|
86156
86206
|
}
|
|
@@ -86165,8 +86215,15 @@ abapGit does not work with CRLF`,
|
|
|
86165
86215
|
}
|
|
86166
86216
|
run(obj) {
|
|
86167
86217
|
const output = [];
|
|
86218
|
+
if (obj instanceof objects_1.MIMEObject || obj instanceof objects_1.WebMIME) {
|
|
86219
|
+
return output;
|
|
86220
|
+
}
|
|
86168
86221
|
for (const file of obj.getFiles()) {
|
|
86169
|
-
|
|
86222
|
+
const filename = file.getFilename();
|
|
86223
|
+
if (filename.endsWith(".abap") || filename.endsWith(".xml")) {
|
|
86224
|
+
if (filename.endsWith(".xslt.source.xml")) {
|
|
86225
|
+
continue;
|
|
86226
|
+
}
|
|
86170
86227
|
const rows = file.getRawRows();
|
|
86171
86228
|
for (let i = 0; i < rows.length; i++) {
|
|
86172
86229
|
if (rows[i].endsWith("\r") === true) {
|
|
@@ -100692,6 +100749,7 @@ class XMLConsistency {
|
|
|
100692
100749
|
* XML is well-formed and parseable
|
|
100693
100750
|
* Naming for CLAS and INTF objects
|
|
100694
100751
|
* QUAN fields in TABL objects have reference table and field values
|
|
100752
|
+
* Transparent TABL objects have delivery class and size category set
|
|
100695
100753
|
* Lock parameter names in ENQU objects are max 16 characters
|
|
100696
100754
|
* Texts and translations do not exceed maximum allowed length.`,
|
|
100697
100755
|
tags: [_irule_1.RuleTag.Naming, _irule_1.RuleTag.Syntax],
|
|
@@ -100950,15 +101008,25 @@ class XMLConsistency {
|
|
|
100950
101008
|
return issues;
|
|
100951
101009
|
}
|
|
100952
101010
|
runTable(obj, file) {
|
|
100953
|
-
var _a, _b;
|
|
100954
|
-
var
|
|
101011
|
+
var _a, _b, _c, _d;
|
|
101012
|
+
var _e;
|
|
100955
101013
|
const issues = [];
|
|
100956
|
-
for (const field of (
|
|
101014
|
+
for (const field of (_e = obj.getFields()) !== null && _e !== void 0 ? _e : []) {
|
|
100957
101015
|
if (field.DATATYPE === "QUAN" && (!((_a = field.REFTABLE) === null || _a === void 0 ? void 0 : _a.trim()) || !((_b = field.REFFIELD) === null || _b === void 0 ? void 0 : _b.trim()))) {
|
|
100958
101016
|
const message = `QUAN field ${field.FIELDNAME} must have REFTABLE and REFFIELD set`;
|
|
100959
101017
|
issues.push(issue_1.Issue.atRow(file, 1, message, this.getMetadata().key, this.conf.severity));
|
|
100960
101018
|
}
|
|
100961
101019
|
}
|
|
101020
|
+
if (obj.getTableCategory() === Objects.TableCategory.Transparent) {
|
|
101021
|
+
if (!((_c = obj.getDeliveryClass()) === null || _c === void 0 ? void 0 : _c.trim())) {
|
|
101022
|
+
const message = `Transparent table must have delivery class(CONTFLAG in DD02V) set`;
|
|
101023
|
+
issues.push(issue_1.Issue.atRow(file, 1, message, this.getMetadata().key, this.conf.severity));
|
|
101024
|
+
}
|
|
101025
|
+
if (!((_d = obj.getSizeCategory()) === null || _d === void 0 ? void 0 : _d.trim())) {
|
|
101026
|
+
const message = `Transparent table must have size category(TABKAT in DD09L) set`;
|
|
101027
|
+
issues.push(issue_1.Issue.atRow(file, 1, message, this.getMetadata().key, this.conf.severity));
|
|
101028
|
+
}
|
|
101029
|
+
}
|
|
100962
101030
|
return issues;
|
|
100963
101031
|
}
|
|
100964
101032
|
}
|
|
@@ -105467,11 +105535,14 @@ const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/tr
|
|
|
105467
105535
|
class MethodCallTranspiler {
|
|
105468
105536
|
postName;
|
|
105469
105537
|
method;
|
|
105470
|
-
|
|
105471
|
-
|
|
105472
|
-
|
|
105538
|
+
discardResult;
|
|
105539
|
+
/** @param postName inserted between the method name and the parameters, eg. ".bind(this)"
|
|
105540
|
+
* @param method the already resolved method reference, saves looking it up again
|
|
105541
|
+
* @param discardResult the RETURNING value of this call is not consumed */
|
|
105542
|
+
constructor(postName = "", method, discardResult = false) {
|
|
105473
105543
|
this.postName = postName;
|
|
105474
105544
|
this.method = method;
|
|
105545
|
+
this.discardResult = discardResult;
|
|
105475
105546
|
}
|
|
105476
105547
|
transpile(node, traversal) {
|
|
105477
105548
|
let post = "";
|
|
@@ -105482,7 +105553,8 @@ class MethodCallTranspiler {
|
|
|
105482
105553
|
const scope = traversal.findCurrentScopeByToken(nameToken);
|
|
105483
105554
|
const m = this.method ?? traversal.findMethodReference(nameToken, scope);
|
|
105484
105555
|
let name = nameToken.getStr().toLowerCase();
|
|
105485
|
-
|
|
105556
|
+
const isBuiltin = traversal.isBuiltinMethod(nameToken);
|
|
105557
|
+
if (isBuiltin) {
|
|
105486
105558
|
// todo: this is not correct, the method name might be shadowed
|
|
105487
105559
|
name = "abap.builtin." + name + "(";
|
|
105488
105560
|
if (name === "abap.builtin.line_exists(" || name === "abap.builtin.line_index(") {
|
|
@@ -105516,9 +105588,14 @@ class MethodCallTranspiler {
|
|
|
105516
105588
|
if (step === undefined) {
|
|
105517
105589
|
throw new Error("MethodCallTranspiler, unexpected node");
|
|
105518
105590
|
}
|
|
105591
|
+
// "IS SUPPLIED" on a RETURNING parameter is true when the call is functional,
|
|
105592
|
+
// the flag is only passed along when the value of this very call is consumed
|
|
105593
|
+
const returning = isBuiltin === true || this.discardResult === true
|
|
105594
|
+
? undefined
|
|
105595
|
+
: m?.def.getParameters().getReturning()?.getName().toLowerCase();
|
|
105519
105596
|
const ret = new chunk_1.Chunk();
|
|
105520
105597
|
ret.append(name, nameToken, traversal);
|
|
105521
|
-
ret.appendChunk(new method_call_param_1.MethodCallParamTranspiler(m?.def).transpile(step, traversal));
|
|
105598
|
+
ret.appendChunk(new method_call_param_1.MethodCallParamTranspiler(m?.def, returning).transpile(step, traversal));
|
|
105522
105599
|
ret.appendString(post + ")");
|
|
105523
105600
|
return ret;
|
|
105524
105601
|
}
|
|
@@ -105631,9 +105708,17 @@ const traversal_1 = __webpack_require__(/*! ../traversal */ "./node_modules/@aba
|
|
|
105631
105708
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
105632
105709
|
const method_call_1 = __webpack_require__(/*! ./method_call */ "./node_modules/@abaplint/transpiler/build/src/expressions/method_call.js");
|
|
105633
105710
|
class MethodCallChainTranspiler {
|
|
105711
|
+
discardResult;
|
|
105712
|
+
/** @param discardResult the value of the last call in the chain is not consumed,
|
|
105713
|
+
* ie. the chain is a standalone CALL statement */
|
|
105714
|
+
constructor(discardResult = false) {
|
|
105715
|
+
this.discardResult = discardResult;
|
|
105716
|
+
}
|
|
105634
105717
|
transpile(node, traversal) {
|
|
105635
105718
|
let ret = new chunk_1.Chunk();
|
|
105636
105719
|
const children = node.getChildren();
|
|
105720
|
+
const calls = node.findDirectExpressions(core_1.Expressions.MethodCall);
|
|
105721
|
+
const lastCall = calls[calls.length - 1];
|
|
105637
105722
|
for (const c of children) {
|
|
105638
105723
|
if (c instanceof core_1.Nodes.ExpressionNode && c.get() instanceof core_1.Expressions.MethodCall) {
|
|
105639
105724
|
const isFirst = c === node.getFirstChild();
|
|
@@ -105651,9 +105736,10 @@ class MethodCallChainTranspiler {
|
|
|
105651
105736
|
method = traversal.findMethodReference(nameToken, traversal.findCurrentScopeByToken(nameToken));
|
|
105652
105737
|
prefix = traversal.constructorPrototypePrefix(nameToken, method?.def, enclosingClass);
|
|
105653
105738
|
}
|
|
105739
|
+
const discard = this.discardResult === true && c === lastCall;
|
|
105654
105740
|
const sub = prefix === undefined
|
|
105655
|
-
?
|
|
105656
|
-
: new method_call_1.MethodCallTranspiler(".bind(this)", method).transpile(c, traversal);
|
|
105741
|
+
? new method_call_1.MethodCallTranspiler("", undefined, discard).transpile(c, traversal)
|
|
105742
|
+
: new method_call_1.MethodCallTranspiler(".bind(this)", method, discard).transpile(c, traversal);
|
|
105657
105743
|
if (sub.getCode().startsWith("abap.builtin.")
|
|
105658
105744
|
|| sub.getCode().startsWith("await abap.builtin.")) {
|
|
105659
105745
|
ret.appendChunk(sub);
|
|
@@ -105736,32 +105822,43 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
105736
105822
|
exports.MethodCallParamTranspiler = void 0;
|
|
105737
105823
|
const core_1 = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
105738
105824
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
105825
|
+
const parameter_list_s_1 = __webpack_require__(/*! ./parameter_list_s */ "./node_modules/@abaplint/transpiler/build/src/expressions/parameter_list_s.js");
|
|
105739
105826
|
class MethodCallParamTranspiler {
|
|
105740
105827
|
m;
|
|
105741
|
-
|
|
105828
|
+
suppliedReturning;
|
|
105829
|
+
/** On a real system "RETURNING IS SUPPLIED" is true exactly when the method is called
|
|
105830
|
+
* functionally, so the caller has to say so.
|
|
105831
|
+
* @param m the resolved method definition
|
|
105832
|
+
* @param suppliedReturning name of the RETURNING parameter to flag as supplied,
|
|
105833
|
+
* ie. the call is functional and the value is consumed */
|
|
105834
|
+
constructor(m, suppliedReturning) {
|
|
105742
105835
|
this.m = m;
|
|
105836
|
+
this.suppliedReturning = suppliedReturning;
|
|
105743
105837
|
}
|
|
105744
105838
|
transpile(node, traversal) {
|
|
105745
105839
|
let name = "";
|
|
105746
105840
|
if (!(node.get() instanceof core_1.Expressions.MethodCallParam)) {
|
|
105747
105841
|
throw new Error("MethodCallParam, unexpected node, " + node?.get().constructor.name);
|
|
105748
105842
|
}
|
|
105843
|
+
// the RETURNING parameter is passed along when the call is functional, see the constructor
|
|
105844
|
+
const extra = this.suppliedReturning === undefined ? "" : this.suppliedReturning + ": 1";
|
|
105749
105845
|
const source = node.findDirectExpression(core_1.Expressions.Source);
|
|
105750
105846
|
if (source) {
|
|
105751
105847
|
const def = this.m?.getParameters().getDefaultImporting()?.toLowerCase();
|
|
105752
105848
|
if (this.m === undefined || def === undefined) {
|
|
105849
|
+
// the input is not an object, so there is nowhere to put the RETURNING flag
|
|
105753
105850
|
return traversal.traverse(source);
|
|
105754
105851
|
}
|
|
105755
105852
|
else {
|
|
105756
105853
|
return new chunk_1.Chunk()
|
|
105757
105854
|
.appendString("{" + def + ": ")
|
|
105758
105855
|
.appendChunk(traversal.traverse(source))
|
|
105759
|
-
.appendString("}");
|
|
105856
|
+
.appendString(extra === "" ? "}" : ", " + extra + "}");
|
|
105760
105857
|
}
|
|
105761
105858
|
}
|
|
105762
105859
|
const parameters = node.findDirectExpression(core_1.Expressions.ParameterListS);
|
|
105763
105860
|
if (parameters) {
|
|
105764
|
-
return
|
|
105861
|
+
return new parameter_list_s_1.ParameterListSTranspiler(extra).transpile(parameters, traversal);
|
|
105765
105862
|
}
|
|
105766
105863
|
else {
|
|
105767
105864
|
const params = node.findDirectExpression(core_1.Expressions.MethodParameters);
|
|
@@ -105776,7 +105873,13 @@ class MethodCallParamTranspiler {
|
|
|
105776
105873
|
}
|
|
105777
105874
|
}
|
|
105778
105875
|
name = name.replace(/}{/g, ", ");
|
|
105779
|
-
|
|
105876
|
+
if (extra === "") {
|
|
105877
|
+
return new chunk_1.Chunk(name);
|
|
105878
|
+
}
|
|
105879
|
+
else if (name === "") {
|
|
105880
|
+
return new chunk_1.Chunk("{" + extra + "}");
|
|
105881
|
+
}
|
|
105882
|
+
return new chunk_1.Chunk(name.replace(/}$/, ", " + extra + "}"));
|
|
105780
105883
|
}
|
|
105781
105884
|
}
|
|
105782
105885
|
exports.MethodCallParamTranspiler = MethodCallParamTranspiler;
|
|
@@ -106143,6 +106246,11 @@ exports.ParameterListSTranspiler = void 0;
|
|
|
106143
106246
|
const core_1 = __webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js");
|
|
106144
106247
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
106145
106248
|
class ParameterListSTranspiler {
|
|
106249
|
+
extra;
|
|
106250
|
+
/** @param extra appended as an additional field of the emitted object, eg. "result: 1" */
|
|
106251
|
+
constructor(extra = "") {
|
|
106252
|
+
this.extra = extra;
|
|
106253
|
+
}
|
|
106146
106254
|
transpile(node, traversal) {
|
|
106147
106255
|
const parameters = [];
|
|
106148
106256
|
for (const c of node.getChildren()) {
|
|
@@ -106150,7 +106258,8 @@ class ParameterListSTranspiler {
|
|
|
106150
106258
|
parameters.push(traversal.traverse(c));
|
|
106151
106259
|
}
|
|
106152
106260
|
}
|
|
106153
|
-
|
|
106261
|
+
const post = this.extra === "" ? "}" : ", " + this.extra + "}";
|
|
106262
|
+
return new chunk_1.Chunk().appendString("{").join(parameters).appendString(post);
|
|
106154
106263
|
}
|
|
106155
106264
|
}
|
|
106156
106265
|
exports.ParameterListSTranspiler = ParameterListSTranspiler;
|
|
@@ -111552,7 +111661,8 @@ class CallTranspiler {
|
|
|
111552
111661
|
pre = build.pre + pre;
|
|
111553
111662
|
post += build.post;
|
|
111554
111663
|
}
|
|
111555
|
-
|
|
111664
|
+
// without RECEIVING the value of the last call in the chain is thrown away
|
|
111665
|
+
const chainChunk = new expressions_1.MethodCallChainTranspiler(receiving === undefined).transpile(chain, traversal);
|
|
111556
111666
|
let chainCode = chainChunk.getCode();
|
|
111557
111667
|
if (chainCode.startsWith("await super.constructor(")) {
|
|
111558
111668
|
// semantics of constructors in JS vs ABAP is different, so the "constructor_" has been introduced,
|
|
@@ -113205,12 +113315,19 @@ class DataTranspiler {
|
|
|
113205
113315
|
value = "\n" + traversal_1.Traversal.prefixVariable(found.getName().toLowerCase()) + ".set(\"" + enumDefault + "\");";
|
|
113206
113316
|
}
|
|
113207
113317
|
}
|
|
113318
|
+
let packedDecimals;
|
|
113319
|
+
if (found.getType() instanceof abaplint.BasicTypes.PackedType) {
|
|
113320
|
+
const decimals = node.findFirstExpression(abaplint.Expressions.Decimals)?.findFirstExpression(abaplint.Expressions.Integer);
|
|
113321
|
+
if (decimals) {
|
|
113322
|
+
packedDecimals = parseInt(decimals.concatTokens(), 10);
|
|
113323
|
+
}
|
|
113324
|
+
}
|
|
113208
113325
|
this.variableName = traversal_1.Traversal.prefixVariable(traversal_1.Traversal.escapeNamespace(found.getName().toLowerCase()));
|
|
113209
113326
|
this.loopScoped = traversal.isInsideLoop(node);
|
|
113210
113327
|
const ret = new chunk_1.Chunk()
|
|
113211
113328
|
.appendString(this.loopScoped === true ? "var " : "let ")
|
|
113212
113329
|
.appendString(this.variableName)
|
|
113213
|
-
.appendString(" = " + transpile_types_1.TranspileTypes.toType(found.getType()))
|
|
113330
|
+
.appendString(" = " + transpile_types_1.TranspileTypes.toType(found.getType(), { packedDecimals }))
|
|
113214
113331
|
.appendString(";")
|
|
113215
113332
|
.appendString(value);
|
|
113216
113333
|
if (this.loopScoped === true && this.skipLoopScoping === false) {
|
|
@@ -116349,6 +116466,11 @@ class MethodImplementationTranspiler {
|
|
|
116349
116466
|
}
|
|
116350
116467
|
}
|
|
116351
116468
|
else if (identifier.getMeta().includes("returning" /* abaplint.IdentifierMeta.MethodReturning */)) {
|
|
116469
|
+
// the caller flags a consumed RETURNING value in INPUT, see MethodCallParamTranspiler,
|
|
116470
|
+
// so "result IS SUPPLIED" needs the parameter even if the method has nothing else
|
|
116471
|
+
if (unique === "") {
|
|
116472
|
+
unique = "INPUT";
|
|
116473
|
+
}
|
|
116352
116474
|
after = after + transpile_types_1.TranspileTypes.declare(identifier) + "\n";
|
|
116353
116475
|
}
|
|
116354
116476
|
}
|
|
@@ -118383,6 +118505,7 @@ class SelectTranspiler {
|
|
|
118383
118505
|
throw new Error("SelectTranspiler, UNION DISTINCT todo");
|
|
118384
118506
|
}
|
|
118385
118507
|
let target = "undefined";
|
|
118508
|
+
let intoCorrespondingStructure = false;
|
|
118386
118509
|
if (targetOverride) {
|
|
118387
118510
|
// SelectLoop structure uses override
|
|
118388
118511
|
target = targetOverride;
|
|
@@ -118394,7 +118517,9 @@ class SelectTranspiler {
|
|
|
118394
118517
|
target = traversal.traverse(node.findFirstExpression(abaplint.Expressions.SQLIntoList)).getCode();
|
|
118395
118518
|
}
|
|
118396
118519
|
else if (node.findFirstExpression(abaplint.Expressions.SQLIntoStructure)) {
|
|
118397
|
-
|
|
118520
|
+
const into = node.findFirstExpression(abaplint.Expressions.SQLIntoStructure);
|
|
118521
|
+
target = traversal.traverse(into).getCode();
|
|
118522
|
+
intoCorrespondingStructure = into.findDirectTokenByText("CORRESPONDING") !== undefined;
|
|
118398
118523
|
}
|
|
118399
118524
|
const tokens = node.getTokens();
|
|
118400
118525
|
const isDistinct = tokens[0]?.getStr().toUpperCase() === "SELECT"
|
|
@@ -118472,6 +118597,9 @@ class SelectTranspiler {
|
|
|
118472
118597
|
if (concat.includes(" APPENDING TABLE ") || concat.includes(" APPENDING CORRESPONDING FIELDS OF TABLE ")) {
|
|
118473
118598
|
runtimeOptionsList.push(`appending: true`);
|
|
118474
118599
|
}
|
|
118600
|
+
if (intoCorrespondingStructure) {
|
|
118601
|
+
runtimeOptionsList.push(`corresponding: true`);
|
|
118602
|
+
}
|
|
118475
118603
|
if (runtimeOptionsList.length > 0) {
|
|
118476
118604
|
runtimeOptions = `, {` + runtimeOptionsList.join(", ") + `}`;
|
|
118477
118605
|
}
|
|
@@ -122450,7 +122578,7 @@ class TranspileTypes {
|
|
|
122450
122578
|
// return singleton,
|
|
122451
122579
|
return "(() => { let _t; return () => (_t ??= " + this.toType(type) + "); })()";
|
|
122452
122580
|
}
|
|
122453
|
-
static toType(type) {
|
|
122581
|
+
static toType(type, options) {
|
|
122454
122582
|
let resolved = "";
|
|
122455
122583
|
let extra = "";
|
|
122456
122584
|
if (type instanceof abaplint.BasicTypes.ObjectReferenceType
|
|
@@ -122573,11 +122701,12 @@ class TranspileTypes {
|
|
|
122573
122701
|
}
|
|
122574
122702
|
else if (type instanceof abaplint.BasicTypes.PackedType) {
|
|
122575
122703
|
resolved = "Packed";
|
|
122704
|
+
const decimals = options?.packedDecimals ?? type.getDecimals();
|
|
122576
122705
|
if (type.getQualifiedName()) {
|
|
122577
|
-
extra = "{length: " + type.getLength() + ", decimals: " +
|
|
122706
|
+
extra = "{length: " + type.getLength() + ", decimals: " + decimals + ", qualifiedName: \"" + type.getQualifiedName() + "\"}";
|
|
122578
122707
|
}
|
|
122579
122708
|
else {
|
|
122580
|
-
extra = "{length: " + type.getLength() + ", decimals: " +
|
|
122709
|
+
extra = "{length: " + type.getLength() + ", decimals: " + decimals + "}";
|
|
122581
122710
|
}
|
|
122582
122711
|
}
|
|
122583
122712
|
else if (type instanceof abaplint.BasicTypes.NumericGenericType) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.82",
|
|
4
4
|
"description": "Transpiler - Command Line Interface",
|
|
5
5
|
"funding": "https://github.com/sponsors/larshp",
|
|
6
6
|
"bin": {
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"author": "abaplint",
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@abaplint/core": "^2.120.
|
|
31
|
-
"@abaplint/transpiler": "^2.13.
|
|
30
|
+
"@abaplint/core": "^2.120.45",
|
|
31
|
+
"@abaplint/transpiler": "^2.13.82",
|
|
32
32
|
"@types/glob": "^9.0.0",
|
|
33
33
|
"@types/node": "^26.4.1",
|
|
34
34
|
"@types/progress": "^2.0.7",
|