@abaplint/transpiler-cli 2.5.75 → 2.5.77
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 +73 -98
- package/package.json +4 -4
package/build/bundle.js
CHANGED
|
@@ -8581,7 +8581,7 @@ const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/
|
|
|
8581
8581
|
const version_1 = __webpack_require__(/*! ../../../version */ "./node_modules/@abaplint/core/build/src/version.js");
|
|
8582
8582
|
class CallFunction {
|
|
8583
8583
|
getMatcher() {
|
|
8584
|
-
const starting = (0, combi_1.seq)("STARTING NEW TASK", expressions_1.SimpleSource2);
|
|
8584
|
+
const starting = (0, combi_1.verNot)(version_1.Version.Cloud, (0, combi_1.seq)("STARTING NEW TASK", expressions_1.SimpleSource2));
|
|
8585
8585
|
const update = (0, combi_1.verNot)(version_1.Version.Cloud, (0, combi_1.str)("IN UPDATE TASK"));
|
|
8586
8586
|
const unit = (0, combi_1.seq)("UNIT", expressions_1.Source);
|
|
8587
8587
|
const background = (0, combi_1.verNot)(version_1.Version.Cloud, (0, combi_1.seq)("IN BACKGROUND", (0, combi_1.altPrio)("TASK", unit)));
|
|
@@ -19434,6 +19434,18 @@ class CurrentScope {
|
|
|
19434
19434
|
(_a = this.current) === null || _a === void 0 ? void 0 : _a.getData().references.push({ position, resolved: referencing, referenceType: type, extra });
|
|
19435
19435
|
}
|
|
19436
19436
|
///////////////////////////
|
|
19437
|
+
findFunctionModule(name) {
|
|
19438
|
+
if (name === undefined) {
|
|
19439
|
+
return undefined;
|
|
19440
|
+
}
|
|
19441
|
+
for (const fugr of this.reg.getObjectsByType("FUGR")) {
|
|
19442
|
+
const func = fugr.getModule(name);
|
|
19443
|
+
if (func !== undefined) {
|
|
19444
|
+
return func;
|
|
19445
|
+
}
|
|
19446
|
+
}
|
|
19447
|
+
return undefined;
|
|
19448
|
+
}
|
|
19437
19449
|
findObjectDefinition(name) {
|
|
19438
19450
|
if (name === undefined) {
|
|
19439
19451
|
return undefined;
|
|
@@ -25598,6 +25610,7 @@ const source_1 = __webpack_require__(/*! ../expressions/source */ "./node_module
|
|
|
25598
25610
|
const target_1 = __webpack_require__(/*! ../expressions/target */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js");
|
|
25599
25611
|
const field_chain_1 = __webpack_require__(/*! ../expressions/field_chain */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/field_chain.js");
|
|
25600
25612
|
const _reference_1 = __webpack_require__(/*! ../_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
|
|
25613
|
+
const version_1 = __webpack_require__(/*! ../../../version */ "./node_modules/@abaplint/core/build/src/version.js");
|
|
25601
25614
|
class CallFunction {
|
|
25602
25615
|
runSyntax(node, scope, filename) {
|
|
25603
25616
|
// todo, lots of work here, similar to receive.ts
|
|
@@ -25606,6 +25619,13 @@ class CallFunction {
|
|
|
25606
25619
|
if (chain) {
|
|
25607
25620
|
new field_chain_1.FieldChain().runSyntax(chain, scope, filename, _reference_1.ReferenceType.DataReadReference);
|
|
25608
25621
|
}
|
|
25622
|
+
else if (scope.getVersion() === version_1.Version.Cloud
|
|
25623
|
+
&& node.findDirectExpression(Expressions.Destination) === undefined) {
|
|
25624
|
+
const functionName = name === null || name === void 0 ? void 0 : name.concatTokens().replace(/'/, "");
|
|
25625
|
+
if (scope.findFunctionModule(functionName) === undefined) {
|
|
25626
|
+
throw new Error(`Function module "${functionName}" not found/released`);
|
|
25627
|
+
}
|
|
25628
|
+
}
|
|
25609
25629
|
// just recurse
|
|
25610
25630
|
for (const s of node.findAllExpressions(Expressions.Source)) {
|
|
25611
25631
|
new source_1.Source().runSyntax(s, scope, filename);
|
|
@@ -39166,10 +39186,15 @@ class LanguageServer {
|
|
|
39166
39186
|
}
|
|
39167
39187
|
const text = new pretty_printer_1.PrettyPrinter(file, this.reg.getConfig()).run();
|
|
39168
39188
|
const rows = file.getRawRows();
|
|
39169
|
-
|
|
39170
|
-
|
|
39171
|
-
|
|
39172
|
-
|
|
39189
|
+
if (text === file.getRaw()) {
|
|
39190
|
+
return [];
|
|
39191
|
+
}
|
|
39192
|
+
else {
|
|
39193
|
+
return [{
|
|
39194
|
+
range: LServer.Range.create(0, 0, rows.length, rows[rows.length - 1].length + 1),
|
|
39195
|
+
newText: text,
|
|
39196
|
+
}];
|
|
39197
|
+
}
|
|
39173
39198
|
}
|
|
39174
39199
|
// https://microsoft.github.io/language-server-protocol/specifications/specification-3-14/#textDocument_publishDiagnostics
|
|
39175
39200
|
diagnostics(textDocument) {
|
|
@@ -46079,7 +46104,6 @@ exports.PrettyPrinter = void 0;
|
|
|
46079
46104
|
const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
|
|
46080
46105
|
const fix_keyword_case_1 = __webpack_require__(/*! ./fix_keyword_case */ "./node_modules/@abaplint/core/build/src/pretty_printer/fix_keyword_case.js");
|
|
46081
46106
|
const indent_1 = __webpack_require__(/*! ./indent */ "./node_modules/@abaplint/core/build/src/pretty_printer/indent.js");
|
|
46082
|
-
const remove_sequential_blanks_1 = __webpack_require__(/*! ./remove_sequential_blanks */ "./node_modules/@abaplint/core/build/src/pretty_printer/remove_sequential_blanks.js");
|
|
46083
46107
|
const position_1 = __webpack_require__(/*! ../position */ "./node_modules/@abaplint/core/build/src/position.js");
|
|
46084
46108
|
const indentation_1 = __webpack_require__(/*! ../rules/indentation */ "./node_modules/@abaplint/core/build/src/rules/indentation.js");
|
|
46085
46109
|
class PrettyPrinter {
|
|
@@ -46109,8 +46133,6 @@ class PrettyPrinter {
|
|
|
46109
46133
|
}
|
|
46110
46134
|
const indentation = new indent_1.Indent(this.options);
|
|
46111
46135
|
this.result = indentation.execute(this.file, this.result);
|
|
46112
|
-
const removeBlanks = new remove_sequential_blanks_1.RemoveSequentialBlanks(this.config);
|
|
46113
|
-
this.result = removeBlanks.execute(this.file, this.result);
|
|
46114
46136
|
return this.result;
|
|
46115
46137
|
}
|
|
46116
46138
|
}
|
|
@@ -46119,66 +46141,6 @@ exports.PrettyPrinter = PrettyPrinter;
|
|
|
46119
46141
|
|
|
46120
46142
|
/***/ }),
|
|
46121
46143
|
|
|
46122
|
-
/***/ "./node_modules/@abaplint/core/build/src/pretty_printer/remove_sequential_blanks.js":
|
|
46123
|
-
/*!******************************************************************************************!*\
|
|
46124
|
-
!*** ./node_modules/@abaplint/core/build/src/pretty_printer/remove_sequential_blanks.js ***!
|
|
46125
|
-
\******************************************************************************************/
|
|
46126
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
46127
|
-
|
|
46128
|
-
"use strict";
|
|
46129
|
-
|
|
46130
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
46131
|
-
exports.RemoveSequentialBlanks = void 0;
|
|
46132
|
-
const rules_1 = __webpack_require__(/*! ../rules */ "./node_modules/@abaplint/core/build/src/rules/index.js");
|
|
46133
|
-
class RemoveSequentialBlanks {
|
|
46134
|
-
constructor(config) {
|
|
46135
|
-
this.config = config;
|
|
46136
|
-
}
|
|
46137
|
-
execute(file, modified) {
|
|
46138
|
-
const sequentialBlankConfig = this.getSequentialBlankConfig();
|
|
46139
|
-
if (sequentialBlankConfig) {
|
|
46140
|
-
return this.withoutSequentialBlanks(file, modified, sequentialBlankConfig.lines);
|
|
46141
|
-
}
|
|
46142
|
-
return modified;
|
|
46143
|
-
}
|
|
46144
|
-
withoutSequentialBlanks(file, modified, threshold) {
|
|
46145
|
-
const rows = file.getRawRows();
|
|
46146
|
-
let blanks = 0;
|
|
46147
|
-
const rowsToRemove = [];
|
|
46148
|
-
const newBlankCount = (current, row) => {
|
|
46149
|
-
return rules_1.SequentialBlank.isBlankOrWhitespace(row) ? current + 1 : 0;
|
|
46150
|
-
};
|
|
46151
|
-
for (let i = 0; i < rows.length; i++) {
|
|
46152
|
-
blanks = newBlankCount(blanks, rows[i]);
|
|
46153
|
-
if (blanks === threshold) {
|
|
46154
|
-
// count additional blanks
|
|
46155
|
-
for (let j = i; j < rows.length; j++) {
|
|
46156
|
-
if (rules_1.SequentialBlank.isBlankOrWhitespace(rows[j])) {
|
|
46157
|
-
rowsToRemove.push(j);
|
|
46158
|
-
}
|
|
46159
|
-
else {
|
|
46160
|
-
break;
|
|
46161
|
-
}
|
|
46162
|
-
}
|
|
46163
|
-
}
|
|
46164
|
-
}
|
|
46165
|
-
return this.removeRows(modified.split("\n"), rowsToRemove);
|
|
46166
|
-
}
|
|
46167
|
-
removeRows(lines, rowsToRemove) {
|
|
46168
|
-
const withoutRemoved = lines.filter((_, idx) => {
|
|
46169
|
-
return rowsToRemove.indexOf(idx) === -1;
|
|
46170
|
-
});
|
|
46171
|
-
return withoutRemoved.join("\n").trim();
|
|
46172
|
-
}
|
|
46173
|
-
getSequentialBlankConfig() {
|
|
46174
|
-
return this.config.readByRule(new rules_1.SequentialBlank().getMetadata().key);
|
|
46175
|
-
}
|
|
46176
|
-
}
|
|
46177
|
-
exports.RemoveSequentialBlanks = RemoveSequentialBlanks;
|
|
46178
|
-
//# sourceMappingURL=remove_sequential_blanks.js.map
|
|
46179
|
-
|
|
46180
|
-
/***/ }),
|
|
46181
|
-
|
|
46182
46144
|
/***/ "./node_modules/@abaplint/core/build/src/registry.js":
|
|
46183
46145
|
/*!***********************************************************!*\
|
|
46184
46146
|
!*** ./node_modules/@abaplint/core/build/src/registry.js ***!
|
|
@@ -46251,7 +46213,7 @@ class Registry {
|
|
|
46251
46213
|
}
|
|
46252
46214
|
static abaplintVersion() {
|
|
46253
46215
|
// magic, see build script "version.sh"
|
|
46254
|
-
return "2.97.
|
|
46216
|
+
return "2.97.5";
|
|
46255
46217
|
}
|
|
46256
46218
|
getDDICReferences() {
|
|
46257
46219
|
return this.references;
|
|
@@ -71307,7 +71269,7 @@ const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/tr
|
|
|
71307
71269
|
const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/@abaplint/transpiler/build/src/expressions/index.js");
|
|
71308
71270
|
class CallTranspiler {
|
|
71309
71271
|
transpile(node, traversal) {
|
|
71310
|
-
var _a, _b, _c, _d
|
|
71272
|
+
var _a, _b, _c, _d;
|
|
71311
71273
|
const chain = node.findDirectExpression(abaplint.Expressions.MethodCallChain);
|
|
71312
71274
|
if (chain) {
|
|
71313
71275
|
let pre = "";
|
|
@@ -71317,34 +71279,12 @@ class CallTranspiler {
|
|
|
71317
71279
|
pre = traversal.traverse(receiving).getCode() + ".set(";
|
|
71318
71280
|
post = ")";
|
|
71319
71281
|
}
|
|
71320
|
-
const exceptions = node.findFirstExpression(abaplint.Expressions.ParameterListExceptions);
|
|
71321
|
-
if (exceptions) {
|
|
71322
|
-
pre = "try {\n" + pre;
|
|
71323
|
-
}
|
|
71324
71282
|
post += ";";
|
|
71283
|
+
const exceptions = node.findFirstExpression(abaplint.Expressions.ParameterListExceptions);
|
|
71325
71284
|
if (exceptions) {
|
|
71326
|
-
|
|
71327
|
-
|
|
71328
|
-
|
|
71329
|
-
switch (e.classic.toUpperCase()) {\n`;
|
|
71330
|
-
for (const e of exceptions.findAllExpressions(abaplint.Expressions.ParameterException)) {
|
|
71331
|
-
const name = e.getFirstToken().getStr().toUpperCase();
|
|
71332
|
-
const value = (_c = e.findFirstExpression(abaplint.Expressions.SimpleName)) === null || _c === void 0 ? void 0 : _c.getFirstToken().getStr().toUpperCase();
|
|
71333
|
-
if (value === undefined) {
|
|
71334
|
-
continue;
|
|
71335
|
-
}
|
|
71336
|
-
if (name === "OTHERS") {
|
|
71337
|
-
post += `default: abap.builtin.sy.get().subrc.set(${value}); break;\n`;
|
|
71338
|
-
}
|
|
71339
|
-
else {
|
|
71340
|
-
post += `case "${name}": abap.builtin.sy.get().subrc.set(${value}); break;\n`;
|
|
71341
|
-
}
|
|
71342
|
-
}
|
|
71343
|
-
post += ` }
|
|
71344
|
-
} else {
|
|
71345
|
-
throw e;
|
|
71346
|
-
}
|
|
71347
|
-
}`;
|
|
71285
|
+
const build = this.buildExceptions(exceptions);
|
|
71286
|
+
pre = build.pre + pre;
|
|
71287
|
+
post += build.post;
|
|
71348
71288
|
}
|
|
71349
71289
|
const chainChunk = traversal.traverse(chain);
|
|
71350
71290
|
let chainCode = chainChunk.getCode();
|
|
@@ -71360,7 +71300,7 @@ if (e.classic) {
|
|
|
71360
71300
|
const methodSource = node.findDirectExpression(abaplint.Expressions.MethodSource);
|
|
71361
71301
|
if (methodSource) {
|
|
71362
71302
|
let body = "";
|
|
71363
|
-
const nameToken = (
|
|
71303
|
+
const nameToken = (_c = methodSource.getLastChild()) === null || _c === void 0 ? void 0 : _c.getFirstToken();
|
|
71364
71304
|
const m = nameToken ? traversal.findMethodReference(nameToken, traversal.findCurrentScopeByToken(nameToken)) : undefined;
|
|
71365
71305
|
const methodCallBody = node.findDirectExpression(abaplint.Expressions.MethodCallBody);
|
|
71366
71306
|
if (methodCallBody) {
|
|
@@ -71368,12 +71308,18 @@ if (e.classic) {
|
|
|
71368
71308
|
}
|
|
71369
71309
|
let pre = "";
|
|
71370
71310
|
let post = "";
|
|
71371
|
-
const receiving = (
|
|
71311
|
+
const receiving = (_d = node.findFirstExpression(abaplint.Expressions.MethodParameters)) === null || _d === void 0 ? void 0 : _d.findExpressionAfterToken("RECEIVING");
|
|
71372
71312
|
if (receiving) {
|
|
71373
71313
|
const target = traversal.traverse(receiving.findDirectExpression(abaplint.Expressions.Target));
|
|
71374
71314
|
pre = target.getCode() + ".set(";
|
|
71375
71315
|
post = ")";
|
|
71376
71316
|
}
|
|
71317
|
+
const exceptions = node.findFirstExpression(abaplint.Expressions.ParameterListExceptions);
|
|
71318
|
+
if (exceptions) {
|
|
71319
|
+
const build = this.buildExceptions(exceptions);
|
|
71320
|
+
pre = build.pre + pre;
|
|
71321
|
+
post += build.post;
|
|
71322
|
+
}
|
|
71377
71323
|
let ms = new expressions_1.MethodSourceTranspiler(pre).transpile(methodSource, traversal).getCode();
|
|
71378
71324
|
if (ms === "await super.get().constructor") {
|
|
71379
71325
|
// semantics of constructors in JS vs ABAP is different, so the "constructor_" has been introduced,
|
|
@@ -71386,6 +71332,35 @@ if (e.classic) {
|
|
|
71386
71332
|
}
|
|
71387
71333
|
throw new Error("CallTranspiler, todo");
|
|
71388
71334
|
}
|
|
71335
|
+
buildExceptions(node) {
|
|
71336
|
+
var _a;
|
|
71337
|
+
let pre = "";
|
|
71338
|
+
let post = "";
|
|
71339
|
+
pre = "try {\n" + pre;
|
|
71340
|
+
post += `\nabap.builtin.sy.get().subrc.set(0);
|
|
71341
|
+
} catch (e) {
|
|
71342
|
+
if (e.classic) {
|
|
71343
|
+
switch (e.classic.toUpperCase()) {\n`;
|
|
71344
|
+
for (const e of node.findAllExpressions(abaplint.Expressions.ParameterException)) {
|
|
71345
|
+
const name = e.getFirstToken().getStr().toUpperCase();
|
|
71346
|
+
const value = (_a = e.findFirstExpression(abaplint.Expressions.SimpleName)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr().toUpperCase();
|
|
71347
|
+
if (value === undefined) {
|
|
71348
|
+
continue;
|
|
71349
|
+
}
|
|
71350
|
+
if (name === "OTHERS") {
|
|
71351
|
+
post += `default: abap.builtin.sy.get().subrc.set(${value}); break;\n`;
|
|
71352
|
+
}
|
|
71353
|
+
else {
|
|
71354
|
+
post += `case "${name}": abap.builtin.sy.get().subrc.set(${value}); break;\n`;
|
|
71355
|
+
}
|
|
71356
|
+
}
|
|
71357
|
+
post += ` }
|
|
71358
|
+
} else {
|
|
71359
|
+
throw e;
|
|
71360
|
+
}
|
|
71361
|
+
}`;
|
|
71362
|
+
return { pre, post };
|
|
71363
|
+
}
|
|
71389
71364
|
}
|
|
71390
71365
|
exports.CallTranspiler = CallTranspiler;
|
|
71391
71366
|
//# sourceMappingURL=call.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.77",
|
|
4
4
|
"description": "Transpiler - Command Line Interface",
|
|
5
5
|
"bin": {
|
|
6
6
|
"abap_transpile": "./abap_transpile"
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"author": "abaplint",
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@abaplint/transpiler": "^2.5.
|
|
28
|
+
"@abaplint/transpiler": "^2.5.77",
|
|
29
29
|
"@types/glob": "^7.2.0",
|
|
30
30
|
"glob": "=7.2.0",
|
|
31
31
|
"@types/progress": "^2.0.5",
|
|
32
32
|
"@types/node": "^18.15.11",
|
|
33
|
-
"@abaplint/core": "^2.97.
|
|
33
|
+
"@abaplint/core": "^2.97.5",
|
|
34
34
|
"progress": "^2.0.3",
|
|
35
|
-
"webpack": "^5.
|
|
35
|
+
"webpack": "^5.78.0",
|
|
36
36
|
"webpack-cli": "^5.0.1",
|
|
37
37
|
"typescript": "^5.0.3"
|
|
38
38
|
}
|