@abaplint/transpiler-cli 2.13.91 → 2.13.93
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 +342 -25
- package/build/types.d.ts +7 -0
- package/package.json +3 -3
package/build/bundle.js
CHANGED
|
@@ -35333,6 +35333,11 @@ class Source {
|
|
|
35333
35333
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
35334
35334
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
35335
35335
|
}
|
|
35336
|
+
if ((foundType === null || foundType === void 0 ? void 0 : foundType.isGeneric()) && bodyType !== undefined) {
|
|
35337
|
+
this.addIfInferred(node, input, bodyType);
|
|
35338
|
+
this.traverseRemainingChildren(children, input);
|
|
35339
|
+
return bodyType;
|
|
35340
|
+
}
|
|
35336
35341
|
this.addIfInferred(node, input, foundType);
|
|
35337
35342
|
this.traverseRemainingChildren(children, input);
|
|
35338
35343
|
return foundType;
|
|
@@ -71237,7 +71242,7 @@ class Registry {
|
|
|
71237
71242
|
}
|
|
71238
71243
|
static abaplintVersion() {
|
|
71239
71244
|
// magic, see build script "version.js"
|
|
71240
|
-
return "2.120.
|
|
71245
|
+
return "2.120.59";
|
|
71241
71246
|
}
|
|
71242
71247
|
getDDICReferences() {
|
|
71243
71248
|
return this.ddicReferences;
|
|
@@ -85675,6 +85680,7 @@ __exportStar(__webpack_require__(/*! ./types_naming */ "./node_modules/@abaplint
|
|
|
85675
85680
|
__exportStar(__webpack_require__(/*! ./uncaught_exception */ "./node_modules/@abaplint/core/build/src/rules/uncaught_exception.js"), exports);
|
|
85676
85681
|
__exportStar(__webpack_require__(/*! ./unknown_types */ "./node_modules/@abaplint/core/build/src/rules/unknown_types.js"), exports);
|
|
85677
85682
|
__exportStar(__webpack_require__(/*! ./unnecessary_chaining */ "./node_modules/@abaplint/core/build/src/rules/unnecessary_chaining.js"), exports);
|
|
85683
|
+
__exportStar(__webpack_require__(/*! ./unnecessary_loop_guard */ "./node_modules/@abaplint/core/build/src/rules/unnecessary_loop_guard.js"), exports);
|
|
85678
85684
|
__exportStar(__webpack_require__(/*! ./unnecessary_pragma */ "./node_modules/@abaplint/core/build/src/rules/unnecessary_pragma.js"), exports);
|
|
85679
85685
|
__exportStar(__webpack_require__(/*! ./unnecessary_return */ "./node_modules/@abaplint/core/build/src/rules/unnecessary_return.js"), exports);
|
|
85680
85686
|
__exportStar(__webpack_require__(/*! ./unreachable_code */ "./node_modules/@abaplint/core/build/src/rules/unreachable_code.js"), exports);
|
|
@@ -85687,6 +85693,7 @@ __exportStar(__webpack_require__(/*! ./unused_variables */ "./node_modules/@abap
|
|
|
85687
85693
|
__exportStar(__webpack_require__(/*! ./use_bool_expression */ "./node_modules/@abaplint/core/build/src/rules/use_bool_expression.js"), exports);
|
|
85688
85694
|
__exportStar(__webpack_require__(/*! ./use_class_based_exceptions */ "./node_modules/@abaplint/core/build/src/rules/use_class_based_exceptions.js"), exports);
|
|
85689
85695
|
__exportStar(__webpack_require__(/*! ./use_line_exists */ "./node_modules/@abaplint/core/build/src/rules/use_line_exists.js"), exports);
|
|
85696
|
+
__exportStar(__webpack_require__(/*! ./use_message_class */ "./node_modules/@abaplint/core/build/src/rules/use_message_class.js"), exports);
|
|
85690
85697
|
__exportStar(__webpack_require__(/*! ./use_new */ "./node_modules/@abaplint/core/build/src/rules/use_new.js"), exports);
|
|
85691
85698
|
__exportStar(__webpack_require__(/*! ./when_others_last */ "./node_modules/@abaplint/core/build/src/rules/when_others_last.js"), exports);
|
|
85692
85699
|
__exportStar(__webpack_require__(/*! ./whitespace_end */ "./node_modules/@abaplint/core/build/src/rules/whitespace_end.js"), exports);
|
|
@@ -99423,6 +99430,151 @@ exports.UnnecessaryChaining = UnnecessaryChaining;
|
|
|
99423
99430
|
|
|
99424
99431
|
/***/ },
|
|
99425
99432
|
|
|
99433
|
+
/***/ "./node_modules/@abaplint/core/build/src/rules/unnecessary_loop_guard.js"
|
|
99434
|
+
/*!*******************************************************************************!*\
|
|
99435
|
+
!*** ./node_modules/@abaplint/core/build/src/rules/unnecessary_loop_guard.js ***!
|
|
99436
|
+
\*******************************************************************************/
|
|
99437
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
99438
|
+
|
|
99439
|
+
"use strict";
|
|
99440
|
+
|
|
99441
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
99442
|
+
if (k2 === undefined) k2 = k;
|
|
99443
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
99444
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
99445
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
99446
|
+
}
|
|
99447
|
+
Object.defineProperty(o, k2, desc);
|
|
99448
|
+
}) : (function(o, m, k, k2) {
|
|
99449
|
+
if (k2 === undefined) k2 = k;
|
|
99450
|
+
o[k2] = m[k];
|
|
99451
|
+
}));
|
|
99452
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
99453
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
99454
|
+
}) : function(o, v) {
|
|
99455
|
+
o["default"] = v;
|
|
99456
|
+
});
|
|
99457
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
99458
|
+
var ownKeys = function(o) {
|
|
99459
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
99460
|
+
var ar = [];
|
|
99461
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
99462
|
+
return ar;
|
|
99463
|
+
};
|
|
99464
|
+
return ownKeys(o);
|
|
99465
|
+
};
|
|
99466
|
+
return function (mod) {
|
|
99467
|
+
if (mod && mod.__esModule) return mod;
|
|
99468
|
+
var result = {};
|
|
99469
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
99470
|
+
__setModuleDefault(result, mod);
|
|
99471
|
+
return result;
|
|
99472
|
+
};
|
|
99473
|
+
})();
|
|
99474
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
99475
|
+
exports.UnnecessaryLoopGuard = exports.UnnecessaryLoopGuardConf = void 0;
|
|
99476
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
|
|
99477
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
|
|
99478
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js"));
|
|
99479
|
+
const Structures = __importStar(__webpack_require__(/*! ../abap/3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js"));
|
|
99480
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
|
|
99481
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
|
|
99482
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
|
|
99483
|
+
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
|
|
99484
|
+
class UnnecessaryLoopGuardConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
99485
|
+
}
|
|
99486
|
+
exports.UnnecessaryLoopGuardConf = UnnecessaryLoopGuardConf;
|
|
99487
|
+
class UnnecessaryLoopGuard extends _abap_rule_1.ABAPRule {
|
|
99488
|
+
constructor() {
|
|
99489
|
+
super(...arguments);
|
|
99490
|
+
this.conf = new UnnecessaryLoopGuardConf();
|
|
99491
|
+
}
|
|
99492
|
+
getMetadata() {
|
|
99493
|
+
return {
|
|
99494
|
+
key: "unnecessary_loop_guard",
|
|
99495
|
+
title: "Unnecessary loop guard",
|
|
99496
|
+
shortDescription: `Detects unnecessary IS [NOT] INITIAL check before LOOP AT`,
|
|
99497
|
+
extendedInformation: `LOOP AT iterates zero times on an empty table, so an IS [NOT] INITIAL guard is redundant.`,
|
|
99498
|
+
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix],
|
|
99499
|
+
badExample: `IF lt_data IS NOT INITIAL.
|
|
99500
|
+
LOOP AT lt_data INTO DATA(ls_item).
|
|
99501
|
+
WRITE ls_item-name.
|
|
99502
|
+
ENDLOOP.
|
|
99503
|
+
ENDIF.`,
|
|
99504
|
+
goodExample: `LOOP AT lt_data INTO DATA(ls_item).
|
|
99505
|
+
WRITE ls_item-name.
|
|
99506
|
+
ENDLOOP.`,
|
|
99507
|
+
};
|
|
99508
|
+
}
|
|
99509
|
+
getConfig() {
|
|
99510
|
+
return this.conf;
|
|
99511
|
+
}
|
|
99512
|
+
setConfig(conf) {
|
|
99513
|
+
this.conf = conf;
|
|
99514
|
+
}
|
|
99515
|
+
runParsed(file) {
|
|
99516
|
+
const issues = [];
|
|
99517
|
+
const stru = file.getStructure();
|
|
99518
|
+
if (stru === undefined) {
|
|
99519
|
+
return issues;
|
|
99520
|
+
}
|
|
99521
|
+
for (const ifStru of stru.findAllStructuresRecursive(Structures.If)) {
|
|
99522
|
+
if (ifStru.findDirectStructures(Structures.ElseIf).length > 0
|
|
99523
|
+
|| ifStru.findDirectStructures(Structures.Else).length > 0) {
|
|
99524
|
+
continue;
|
|
99525
|
+
}
|
|
99526
|
+
const ifStatement = ifStru.findDirectStatement(Statements.If);
|
|
99527
|
+
if (ifStatement === undefined) {
|
|
99528
|
+
continue;
|
|
99529
|
+
}
|
|
99530
|
+
const cond = ifStatement.findDirectExpression(Expressions.Cond);
|
|
99531
|
+
if (cond === undefined) {
|
|
99532
|
+
continue;
|
|
99533
|
+
}
|
|
99534
|
+
const compareNodes = cond.findDirectExpressions(Expressions.Compare);
|
|
99535
|
+
if (compareNodes.length !== 1) {
|
|
99536
|
+
continue;
|
|
99537
|
+
}
|
|
99538
|
+
const m = compareNodes[0].concatTokens().toUpperCase().match(/^(.+?)\s+IS\s+(?:NOT\s+)?INITIAL\s*$/);
|
|
99539
|
+
if (!m) {
|
|
99540
|
+
continue;
|
|
99541
|
+
}
|
|
99542
|
+
const tableName = m[1];
|
|
99543
|
+
const bodyStructures = ifStru.findDirectStructures(Structures.Body);
|
|
99544
|
+
if (bodyStructures.length !== 1) {
|
|
99545
|
+
continue;
|
|
99546
|
+
}
|
|
99547
|
+
const normalStructures = bodyStructures[0].findDirectStructures(Structures.Normal);
|
|
99548
|
+
if (normalStructures.length !== 1) {
|
|
99549
|
+
continue;
|
|
99550
|
+
}
|
|
99551
|
+
const loopStructures = normalStructures[0].findDirectStructures(Structures.Loop);
|
|
99552
|
+
if (loopStructures.length !== 1) {
|
|
99553
|
+
continue;
|
|
99554
|
+
}
|
|
99555
|
+
const loopStatement = loopStructures[0].findDirectStatement(Statements.Loop);
|
|
99556
|
+
if (loopStatement === undefined) {
|
|
99557
|
+
continue;
|
|
99558
|
+
}
|
|
99559
|
+
const loopSource = loopStatement.findFirstExpression(Expressions.LoopSource);
|
|
99560
|
+
if (loopSource === undefined) {
|
|
99561
|
+
continue;
|
|
99562
|
+
}
|
|
99563
|
+
if (loopSource.concatTokens().toUpperCase() !== tableName) {
|
|
99564
|
+
continue;
|
|
99565
|
+
}
|
|
99566
|
+
const endifStatement = ifStru.findDirectStatement(Statements.EndIf);
|
|
99567
|
+
const fix = edit_helper_1.EditHelper.merge(edit_helper_1.EditHelper.deleteStatement(file, ifStatement), edit_helper_1.EditHelper.deleteStatement(file, endifStatement));
|
|
99568
|
+
issues.push(issue_1.Issue.atStatement(file, ifStatement, "Unnecessary IS [NOT] INITIAL check before LOOP AT", this.getMetadata().key, this.conf.severity, fix));
|
|
99569
|
+
}
|
|
99570
|
+
return issues;
|
|
99571
|
+
}
|
|
99572
|
+
}
|
|
99573
|
+
exports.UnnecessaryLoopGuard = UnnecessaryLoopGuard;
|
|
99574
|
+
//# sourceMappingURL=unnecessary_loop_guard.js.map
|
|
99575
|
+
|
|
99576
|
+
/***/ },
|
|
99577
|
+
|
|
99426
99578
|
/***/ "./node_modules/@abaplint/core/build/src/rules/unnecessary_pragma.js"
|
|
99427
99579
|
/*!***************************************************************************!*\
|
|
99428
99580
|
!*** ./node_modules/@abaplint/core/build/src/rules/unnecessary_pragma.js ***!
|
|
@@ -101497,6 +101649,103 @@ exports.UseLineExists = UseLineExists;
|
|
|
101497
101649
|
|
|
101498
101650
|
/***/ },
|
|
101499
101651
|
|
|
101652
|
+
/***/ "./node_modules/@abaplint/core/build/src/rules/use_message_class.js"
|
|
101653
|
+
/*!**************************************************************************!*\
|
|
101654
|
+
!*** ./node_modules/@abaplint/core/build/src/rules/use_message_class.js ***!
|
|
101655
|
+
\**************************************************************************/
|
|
101656
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
101657
|
+
|
|
101658
|
+
"use strict";
|
|
101659
|
+
|
|
101660
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
101661
|
+
if (k2 === undefined) k2 = k;
|
|
101662
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
101663
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
101664
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
101665
|
+
}
|
|
101666
|
+
Object.defineProperty(o, k2, desc);
|
|
101667
|
+
}) : (function(o, m, k, k2) {
|
|
101668
|
+
if (k2 === undefined) k2 = k;
|
|
101669
|
+
o[k2] = m[k];
|
|
101670
|
+
}));
|
|
101671
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
101672
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
101673
|
+
}) : function(o, v) {
|
|
101674
|
+
o["default"] = v;
|
|
101675
|
+
});
|
|
101676
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
101677
|
+
var ownKeys = function(o) {
|
|
101678
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
101679
|
+
var ar = [];
|
|
101680
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
101681
|
+
return ar;
|
|
101682
|
+
};
|
|
101683
|
+
return ownKeys(o);
|
|
101684
|
+
};
|
|
101685
|
+
return function (mod) {
|
|
101686
|
+
if (mod && mod.__esModule) return mod;
|
|
101687
|
+
var result = {};
|
|
101688
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
101689
|
+
__setModuleDefault(result, mod);
|
|
101690
|
+
return result;
|
|
101691
|
+
};
|
|
101692
|
+
})();
|
|
101693
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
101694
|
+
exports.UseMessageClass = exports.UseMessageClassConf = void 0;
|
|
101695
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
|
|
101696
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
|
|
101697
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
|
|
101698
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js"));
|
|
101699
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
|
|
101700
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
|
|
101701
|
+
class UseMessageClassConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
101702
|
+
}
|
|
101703
|
+
exports.UseMessageClassConf = UseMessageClassConf;
|
|
101704
|
+
class UseMessageClass extends _abap_rule_1.ABAPRule {
|
|
101705
|
+
constructor() {
|
|
101706
|
+
super(...arguments);
|
|
101707
|
+
this.conf = new UseMessageClassConf();
|
|
101708
|
+
}
|
|
101709
|
+
getMetadata() {
|
|
101710
|
+
return {
|
|
101711
|
+
key: "use_message_class",
|
|
101712
|
+
title: "Use message class",
|
|
101713
|
+
shortDescription: `Define messages in SE91 instead of using inline text or variables`,
|
|
101714
|
+
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
|
|
101715
|
+
badExample: `MESSAGE 'Something went wrong' TYPE 'E'.`,
|
|
101716
|
+
goodExample: `MESSAGE e001(bc_msg).`,
|
|
101717
|
+
};
|
|
101718
|
+
}
|
|
101719
|
+
getConfig() {
|
|
101720
|
+
return this.conf;
|
|
101721
|
+
}
|
|
101722
|
+
setConfig(conf) {
|
|
101723
|
+
this.conf = conf;
|
|
101724
|
+
}
|
|
101725
|
+
runParsed(file, _obj) {
|
|
101726
|
+
const structure = file.getStructure();
|
|
101727
|
+
if (structure === undefined) {
|
|
101728
|
+
return [];
|
|
101729
|
+
}
|
|
101730
|
+
const issues = [];
|
|
101731
|
+
const key = this.getMetadata().key;
|
|
101732
|
+
for (const statement of structure.findAllStatements(Statements.Message)) {
|
|
101733
|
+
// The parser populates MessageSource only for the class-based forms (e001(bc_msg) or ID/TYPE/NUMBER).
|
|
101734
|
+
// The text form (MESSAGE <source> TYPE <source>) uses MessageSourceSource directly with no MessageSource child.
|
|
101735
|
+
// Absence of MessageSource is therefore a reliable discriminator between the two forms.
|
|
101736
|
+
if (statement.findDirectExpression(Expressions.MessageSource) !== undefined) {
|
|
101737
|
+
continue;
|
|
101738
|
+
}
|
|
101739
|
+
issues.push(issue_1.Issue.atStatement(file, statement, "Use a message class (SE91) instead of inline text or variable", key, this.conf.severity));
|
|
101740
|
+
}
|
|
101741
|
+
return issues;
|
|
101742
|
+
}
|
|
101743
|
+
}
|
|
101744
|
+
exports.UseMessageClass = UseMessageClass;
|
|
101745
|
+
//# sourceMappingURL=use_message_class.js.map
|
|
101746
|
+
|
|
101747
|
+
/***/ },
|
|
101748
|
+
|
|
101500
101749
|
/***/ "./node_modules/@abaplint/core/build/src/rules/use_new.js"
|
|
101501
101750
|
/*!****************************************************************!*\
|
|
101502
101751
|
!*** ./node_modules/@abaplint/core/build/src/rules/use_new.js ***!
|
|
@@ -104938,6 +105187,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
104938
105187
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
104939
105188
|
exports.AttributeNameTranspiler = void 0;
|
|
104940
105189
|
const abaplint = __importStar(__webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js"));
|
|
105190
|
+
const traversal_1 = __webpack_require__(/*! ../traversal */ "./node_modules/@abaplint/transpiler/build/src/traversal.js");
|
|
104941
105191
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
104942
105192
|
class AttributeNameTranspiler {
|
|
104943
105193
|
transpile(node, traversal) {
|
|
@@ -104948,6 +105198,16 @@ class AttributeNameTranspiler {
|
|
|
104948
105198
|
&& ref.getVisibility() === abaplint.Visibility.Private) {
|
|
104949
105199
|
concat = "#" + concat;
|
|
104950
105200
|
}
|
|
105201
|
+
// an attribute declared in an interface lives on the object as "<intf>$<name>",
|
|
105202
|
+
// also when it is reached via an interface reference without the "intf~" alias,
|
|
105203
|
+
// eg. "obj->method( )->value" where method returns "REF TO lif_intf"
|
|
105204
|
+
const interfaceName = traversal.isInterfaceAttribute(node.getFirstToken());
|
|
105205
|
+
if (interfaceName && concat.startsWith(interfaceName) === false) {
|
|
105206
|
+
concat = traversal_1.Traversal.escapeNamespace(interfaceName) + "$" + traversal_1.Traversal.escapeNamespace(concat).replace("~", "$");
|
|
105207
|
+
}
|
|
105208
|
+
else {
|
|
105209
|
+
concat = traversal_1.Traversal.escapeNamespace(concat).replace("~", "$");
|
|
105210
|
+
}
|
|
104951
105211
|
return new chunk_1.Chunk().append(concat, node, traversal);
|
|
104952
105212
|
}
|
|
104953
105213
|
}
|
|
@@ -111645,6 +111905,7 @@ exports.Transpiler = exports.Chunk = exports.UnknownTypesEnum = exports.config =
|
|
|
111645
111905
|
const abaplint = __importStar(__webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js"));
|
|
111646
111906
|
const validation_1 = __webpack_require__(/*! ./validation */ "./node_modules/@abaplint/transpiler/build/src/validation.js");
|
|
111647
111907
|
Object.defineProperty(exports, "config", ({ enumerable: true, get: function () { return validation_1.config; } }));
|
|
111908
|
+
const unique_identifier_1 = __webpack_require__(/*! ./unique_identifier */ "./node_modules/@abaplint/transpiler/build/src/unique_identifier.js");
|
|
111648
111909
|
const unit_test_1 = __webpack_require__(/*! ./unit_test */ "./node_modules/@abaplint/transpiler/build/src/unit_test.js");
|
|
111649
111910
|
const types_1 = __webpack_require__(/*! ./types */ "./node_modules/@abaplint/transpiler/build/src/types.js");
|
|
111650
111911
|
Object.defineProperty(exports, "UnknownTypesEnum", ({ enumerable: true, get: function () { return types_1.UnknownTypesEnum; } }));
|
|
@@ -111703,6 +111964,12 @@ class Transpiler {
|
|
|
111703
111964
|
progress?.set(reg.getObjectCount().total, "Building");
|
|
111704
111965
|
for (const obj of reg.getObjects()) {
|
|
111705
111966
|
await progress?.tick("Building, " + obj.getName());
|
|
111967
|
+
// the temporary names ("unique1", ..., and the DO/WHILE sy-index backups
|
|
111968
|
+
// "indexBackup1", ...) are local to the module an object becomes, so each
|
|
111969
|
+
// object numbers its own: its output then depends on the registry alone,
|
|
111970
|
+
// not on the objects built before it or on an earlier run in the same process
|
|
111971
|
+
unique_identifier_1.UniqueIdentifier.reset();
|
|
111972
|
+
unique_identifier_1.UniqueIdentifier.resetIndexBackup();
|
|
111706
111973
|
if (obj instanceof abaplint.Objects.TypePool) {
|
|
111707
111974
|
output.objects.push(...new handle_type_pool_1.HandleTypePool().runObject(obj, reg));
|
|
111708
111975
|
}
|
|
@@ -115118,10 +115385,12 @@ class DeleteInternalTranspiler {
|
|
|
115118
115385
|
extra.push("where: async " + traversal.traverse(componentCompare).getCode());
|
|
115119
115386
|
}
|
|
115120
115387
|
// todo, this is not completely correct, fields might have the name ADJACENT
|
|
115121
|
-
// comparisons should be on table key unless other is specified, but we're unaware
|
|
115122
115388
|
if (node.findDirectTokenByText("ADJACENT")) {
|
|
115123
115389
|
extra.push("adjacent: true");
|
|
115124
|
-
if (
|
|
115390
|
+
if (concat.includes("COMPARING ALL FIELDS")) {
|
|
115391
|
+
extra.push("allFields: true");
|
|
115392
|
+
}
|
|
115393
|
+
else if (node.findDirectTokenByText("COMPARING")) {
|
|
115125
115394
|
const comparing = node.findAllExpressions(abaplint.Expressions.SimpleFieldChain2);
|
|
115126
115395
|
if (comparing) {
|
|
115127
115396
|
const compareFields = comparing.map(i => "'" + i.getFirstToken().getStr() + "'").join(",");
|
|
@@ -117336,6 +117605,9 @@ class InsertDatabaseTranspiler {
|
|
|
117336
117605
|
const tvalues = traversal.traverse(fromTable);
|
|
117337
117606
|
options.push(`"table": ` + tvalues.getCode());
|
|
117338
117607
|
}
|
|
117608
|
+
if (node.findDirectTokenByText("ACCEPTING") !== undefined) {
|
|
117609
|
+
options.push(`"acceptingDuplicateKeys": true`);
|
|
117610
|
+
}
|
|
117339
117611
|
const connection = node.findDirectExpression(abaplint.Expressions.DatabaseConnection);
|
|
117340
117612
|
if (connection) {
|
|
117341
117613
|
const con = findConnection(connection, traversal);
|
|
@@ -119514,10 +119786,22 @@ class ReadTableTranspiler {
|
|
|
119514
119786
|
const s = traversal.traverse(source).getCode();
|
|
119515
119787
|
let field = "";
|
|
119516
119788
|
let key = left.concatTokens().toLowerCase();
|
|
119789
|
+
// the component name is a JS object key, computed at runtime for a dynamic variable
|
|
119790
|
+
let keyExpression = "";
|
|
119517
119791
|
if (left.get() instanceof abaplint.Expressions.Dynamic
|
|
119518
119792
|
&& left instanceof abaplint.Nodes.ExpressionNode) {
|
|
119519
|
-
|
|
119520
|
-
|
|
119793
|
+
const chain = left.findDirectExpression(abaplint.Expressions.FieldChain);
|
|
119794
|
+
if (chain) {
|
|
119795
|
+
// WITH TABLE KEY (variable) = value
|
|
119796
|
+
const name = new expressions_1.FieldChainTranspiler(true).transpile(chain, traversal).getCode();
|
|
119797
|
+
keyExpression = name + ".trimEnd().toLowerCase()";
|
|
119798
|
+
field = "i[" + keyExpression + "]";
|
|
119799
|
+
}
|
|
119800
|
+
else {
|
|
119801
|
+
// WITH TABLE KEY ('LITERAL') = value
|
|
119802
|
+
key = key.substring(2, key.length - 2);
|
|
119803
|
+
field = "i." + key;
|
|
119804
|
+
}
|
|
119521
119805
|
}
|
|
119522
119806
|
else if (left.get() instanceof abaplint.Expressions.ComponentChainSimple
|
|
119523
119807
|
&& left instanceof abaplint.Nodes.ExpressionNode) {
|
|
@@ -119529,17 +119813,18 @@ class ReadTableTranspiler {
|
|
|
119529
119813
|
if (field === "i.table_line") {
|
|
119530
119814
|
usesTableLine = true;
|
|
119531
119815
|
}
|
|
119816
|
+
const simpleKey = keyExpression !== "" ? "[" + keyExpression + "]" : JSON.stringify(key);
|
|
119532
119817
|
if (s.includes("await")) {
|
|
119533
119818
|
const id = unique_identifier_1.UniqueIdentifier.get();
|
|
119534
119819
|
prefix += "const " + id + " = " + s + ";\n";
|
|
119535
119820
|
withKey.push("abap.compare.eq(" + field + ", " + id + ")");
|
|
119536
119821
|
withKeyValue.push(`{key: (i) => {return ${field}}, value: ${id}}`);
|
|
119537
|
-
withKeySimple.push(`${
|
|
119822
|
+
withKeySimple.push(`${simpleKey}: ${id}`);
|
|
119538
119823
|
}
|
|
119539
119824
|
else {
|
|
119540
119825
|
withKey.push("abap.compare.eq(" + field + ", " + s + ")");
|
|
119541
119826
|
withKeyValue.push(`{key: (i) => {return ${field}}, value: ${s}}`);
|
|
119542
|
-
withKeySimple.push(`${
|
|
119827
|
+
withKeySimple.push(`${simpleKey}: ${s}`);
|
|
119543
119828
|
}
|
|
119544
119829
|
}
|
|
119545
119830
|
extra.push("withKey: (i) => {return " + withKey.join(" && ") + ";}");
|
|
@@ -120273,7 +120558,7 @@ class SelectTranspiler {
|
|
|
120273
120558
|
}
|
|
120274
120559
|
if (!(${target} instanceof abap.types.HashedTable) && ${target}.getOptions()?.primaryKey?.type !== "SORTED") {
|
|
120275
120560
|
abap.statements.sort(${target}, {by: ${by}.map(k => { return {component: k}; })});
|
|
120276
|
-
await abap.statements.deleteInternal(${target}, {adjacent: true,
|
|
120561
|
+
await abap.statements.deleteInternal(${target}, {adjacent: true, allFields: true});
|
|
120277
120562
|
}
|
|
120278
120563
|
abap.builtin.sy.get().dbcnt.set(${target}.getArrayLength());
|
|
120279
120564
|
}`;
|
|
@@ -124459,6 +124744,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
124459
124744
|
})();
|
|
124460
124745
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
124461
124746
|
exports.Traversal = void 0;
|
|
124747
|
+
exports.referencesAt = referencesAt;
|
|
124462
124748
|
const abaplint = __importStar(__webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js"));
|
|
124463
124749
|
const StatementTranspilers = __importStar(__webpack_require__(/*! ./statements */ "./node_modules/@abaplint/transpiler/build/src/statements/index.js"));
|
|
124464
124750
|
const ExpressionTranspilers = __importStar(__webpack_require__(/*! ./expressions */ "./node_modules/@abaplint/transpiler/build/src/expressions/index.js"));
|
|
@@ -124467,6 +124753,43 @@ const transpile_types_1 = __webpack_require__(/*! ./transpile_types */ "./node_m
|
|
|
124467
124753
|
const chunk_1 = __webpack_require__(/*! ./chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
124468
124754
|
const expressions_1 = __webpack_require__(/*! ./expressions */ "./node_modules/@abaplint/transpiler/build/src/expressions/index.js");
|
|
124469
124755
|
const keywords_1 = __webpack_require__(/*! ./keywords */ "./node_modules/@abaplint/transpiler/build/src/keywords.js");
|
|
124756
|
+
/** the references of one scope, by where they start: built once per scope,
|
|
124757
|
+
* so finding the reference at a token no longer walks every reference of
|
|
124758
|
+
* the scope for every token, which made a long method quadratic */
|
|
124759
|
+
const REFERENCE_INDEX = new WeakMap();
|
|
124760
|
+
/** the references of a scope whose start equals the token's start, in the
|
|
124761
|
+
* scope's own order -- the same set and order the linear scan found:
|
|
124762
|
+
* Position.equals compares row and column, a VirtualPosition compares its
|
|
124763
|
+
* virtual row and column and only with another VirtualPosition */
|
|
124764
|
+
function referencesAt(scope, token) {
|
|
124765
|
+
const references = scope.getData().references;
|
|
124766
|
+
let index = REFERENCE_INDEX.get(references);
|
|
124767
|
+
if (index === undefined) {
|
|
124768
|
+
index = { plain: new Map(), virtual: new Map() };
|
|
124769
|
+
references.forEach((r, n) => {
|
|
124770
|
+
const start = r.position.getStart();
|
|
124771
|
+
const key = start instanceof abaplint.VirtualPosition
|
|
124772
|
+
? start.vrow + ":" + start.vcol
|
|
124773
|
+
: start.getRow() + ":" + start.getCol();
|
|
124774
|
+
const map = start instanceof abaplint.VirtualPosition ? index.virtual : index.plain;
|
|
124775
|
+
const list = map.get(key);
|
|
124776
|
+
if (list === undefined) {
|
|
124777
|
+
map.set(key, [n]);
|
|
124778
|
+
}
|
|
124779
|
+
else {
|
|
124780
|
+
list.push(n);
|
|
124781
|
+
}
|
|
124782
|
+
});
|
|
124783
|
+
REFERENCE_INDEX.set(references, index);
|
|
124784
|
+
}
|
|
124785
|
+
const start = token.getStart();
|
|
124786
|
+
const found = [...(index.plain.get(start.getRow() + ":" + start.getCol()) ?? [])];
|
|
124787
|
+
if (start instanceof abaplint.VirtualPosition) {
|
|
124788
|
+
found.push(...(index.virtual.get(start.vrow + ":" + start.vcol) ?? []));
|
|
124789
|
+
found.sort((a, b) => a - b);
|
|
124790
|
+
}
|
|
124791
|
+
return found.map(n => references[n]);
|
|
124792
|
+
}
|
|
124470
124793
|
class Traversal {
|
|
124471
124794
|
spaghetti;
|
|
124472
124795
|
file;
|
|
@@ -124820,9 +125143,8 @@ class Traversal {
|
|
|
124820
125143
|
if (scope === undefined) {
|
|
124821
125144
|
return false;
|
|
124822
125145
|
}
|
|
124823
|
-
for (const r of scope
|
|
124824
|
-
if (r.referenceType === abaplint.ReferenceType.BuiltinMethodReference
|
|
124825
|
-
&& r.position.getStart().equals(token.getStart())) {
|
|
125146
|
+
for (const r of referencesAt(scope, token)) {
|
|
125147
|
+
if (r.referenceType === abaplint.ReferenceType.BuiltinMethodReference) {
|
|
124826
125148
|
return true;
|
|
124827
125149
|
}
|
|
124828
125150
|
}
|
|
@@ -124842,9 +125164,8 @@ class Traversal {
|
|
|
124842
125164
|
if (scope === undefined) {
|
|
124843
125165
|
return undefined;
|
|
124844
125166
|
}
|
|
124845
|
-
for (const r of scope
|
|
125167
|
+
for (const r of referencesAt(scope, token)) {
|
|
124846
125168
|
if (r.referenceType === abaplint.ReferenceType.MethodReference
|
|
124847
|
-
&& r.position.getStart().equals(token.getStart())
|
|
124848
125169
|
&& r.resolved instanceof abaplint.Types.MethodDefinition) {
|
|
124849
125170
|
let name = r.resolved.getName();
|
|
124850
125171
|
if (r.extra?.ooName && r.extra?.ooType === "INTF") {
|
|
@@ -124858,8 +125179,7 @@ class Traversal {
|
|
|
124858
125179
|
}
|
|
124859
125180
|
return candidate;
|
|
124860
125181
|
}
|
|
124861
|
-
else if (r.referenceType === abaplint.ReferenceType.BuiltinMethodReference
|
|
124862
|
-
&& r.position.getStart().equals(token.getStart())) {
|
|
125182
|
+
else if (r.referenceType === abaplint.ReferenceType.BuiltinMethodReference) {
|
|
124863
125183
|
const def = r.resolved;
|
|
124864
125184
|
const name = def.getName();
|
|
124865
125185
|
return { def, name };
|
|
@@ -125007,10 +125327,9 @@ class Traversal {
|
|
|
125007
125327
|
if (scope === undefined) {
|
|
125008
125328
|
return undefined;
|
|
125009
125329
|
}
|
|
125010
|
-
for (const r of scope
|
|
125011
|
-
if (
|
|
125012
|
-
|| r.referenceType === abaplint.ReferenceType.DataWriteReference)
|
|
125013
|
-
&& r.position.getStart().equals(token.getStart())) {
|
|
125330
|
+
for (const r of referencesAt(scope, token)) {
|
|
125331
|
+
if (r.referenceType === abaplint.ReferenceType.DataReadReference
|
|
125332
|
+
|| r.referenceType === abaplint.ReferenceType.DataWriteReference) {
|
|
125014
125333
|
return r.resolved;
|
|
125015
125334
|
}
|
|
125016
125335
|
}
|
|
@@ -125021,9 +125340,8 @@ class Traversal {
|
|
|
125021
125340
|
if (scope === undefined) {
|
|
125022
125341
|
return undefined;
|
|
125023
125342
|
}
|
|
125024
|
-
for (const r of scope
|
|
125025
|
-
if (r.referenceType === abaplint.ReferenceType.InferredType
|
|
125026
|
-
&& r.position.getStart().equals(token.getStart())) {
|
|
125343
|
+
for (const r of referencesAt(scope, token)) {
|
|
125344
|
+
if (r.referenceType === abaplint.ReferenceType.InferredType) {
|
|
125027
125345
|
if (r.resolved instanceof abaplint.TypedIdentifier) {
|
|
125028
125346
|
return r.resolved.getType();
|
|
125029
125347
|
}
|
|
@@ -125036,9 +125354,8 @@ class Traversal {
|
|
|
125036
125354
|
if (scope === undefined) {
|
|
125037
125355
|
return undefined;
|
|
125038
125356
|
}
|
|
125039
|
-
for (const r of scope
|
|
125040
|
-
if (r.referenceType === abaplint.ReferenceType.TypeReference
|
|
125041
|
-
&& r.position.getStart().equals(token.getStart())) {
|
|
125357
|
+
for (const r of referencesAt(scope, token)) {
|
|
125358
|
+
if (r.referenceType === abaplint.ReferenceType.TypeReference) {
|
|
125042
125359
|
if (r.resolved instanceof abaplint.TypedIdentifier) {
|
|
125043
125360
|
return r.resolved.getType();
|
|
125044
125361
|
}
|
package/build/types.d.ts
CHANGED
|
@@ -12,6 +12,13 @@ export interface ITranspilerConfig {
|
|
|
12
12
|
exclude_filter?: string[];
|
|
13
13
|
/** @minLength 1 */
|
|
14
14
|
output_folder: string;
|
|
15
|
+
/** experimental */
|
|
16
|
+
converter?: {
|
|
17
|
+
/** @uniqueItems true */
|
|
18
|
+
input_folder: string | string[];
|
|
19
|
+
/** @minLength 1 */
|
|
20
|
+
output_folder: string;
|
|
21
|
+
};
|
|
15
22
|
libs?: {
|
|
16
23
|
url?: string;
|
|
17
24
|
/** relative to the current working directory */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.93",
|
|
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.59",
|
|
31
|
+
"@abaplint/transpiler": "^2.13.93",
|
|
32
32
|
"@types/glob": "^9.0.0",
|
|
33
33
|
"@types/node": "^26.6.2",
|
|
34
34
|
"@types/progress": "^2.0.7",
|