@abaplint/transpiler-cli 2.5.30 → 2.5.32
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 +62 -15
- package/package.json +3 -3
package/build/bundle.js
CHANGED
|
@@ -444,7 +444,10 @@ class Lexer {
|
|
|
444
444
|
const ahead = this.stream.nextChar();
|
|
445
445
|
const aahead = this.stream.nextNextChar();
|
|
446
446
|
if (this.m === this.ModeNormal) {
|
|
447
|
-
if (ahead
|
|
447
|
+
if (splits[ahead]) {
|
|
448
|
+
this.add();
|
|
449
|
+
}
|
|
450
|
+
else if (ahead === "'") {
|
|
448
451
|
// start string
|
|
449
452
|
this.add();
|
|
450
453
|
this.m = this.ModeStr;
|
|
@@ -470,9 +473,6 @@ class Lexer {
|
|
|
470
473
|
this.add();
|
|
471
474
|
this.m = this.ModeComment;
|
|
472
475
|
}
|
|
473
|
-
else if (splits[ahead]) {
|
|
474
|
-
this.add();
|
|
475
|
-
}
|
|
476
476
|
else if (ahead === "@" && buf.trim().length === 0) {
|
|
477
477
|
this.add();
|
|
478
478
|
}
|
|
@@ -33364,8 +33364,11 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
33364
33364
|
exports.StructureType = void 0;
|
|
33365
33365
|
const _abstract_type_1 = __webpack_require__(/*! ./_abstract_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/_abstract_type.js");
|
|
33366
33366
|
class StructureType extends _abstract_type_1.AbstractType {
|
|
33367
|
-
constructor(components, qualifiedName) {
|
|
33368
|
-
super({
|
|
33367
|
+
constructor(components, qualifiedName, ddicName) {
|
|
33368
|
+
super({
|
|
33369
|
+
qualifiedName: qualifiedName,
|
|
33370
|
+
ddicName: ddicName,
|
|
33371
|
+
});
|
|
33369
33372
|
if (components.length === 0) {
|
|
33370
33373
|
throw new Error("Structure does not contain any components");
|
|
33371
33374
|
}
|
|
@@ -37585,7 +37588,8 @@ exports.MemoryFile = MemoryFile;
|
|
|
37585
37588
|
"use strict";
|
|
37586
37589
|
|
|
37587
37590
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
37588
|
-
exports.
|
|
37591
|
+
exports.Severity = exports.Visibility = exports.Info = exports.Rename = exports.PrettyPrinter = exports.Position = exports.CurrentScope = exports.ABAPFile = exports.RulesRunner = exports.SpaghettiScope = exports.SyntaxLogic = exports.ABAPObject = exports.Tokens = exports.ExpressionsCDS = exports.CDSParser = exports.LanguageServerTypes = exports.DDLParser = exports.applyEditList = exports.applyEditSingle = exports.SpaghettiScopeNode = exports.AbstractFile = exports.Token = exports.ScopeType = exports.BasicTypes = exports.TypedIdentifier = exports.AbstractType = exports.VirtualPosition = exports.Comment = exports.Unknown = exports.Empty = exports.Identifier = exports.Nodes = exports.Types = exports.Expressions = exports.Statements = exports.Structures = exports.Objects = exports.ArtifactsRules = exports.ArtifactsObjects = exports.ArtifactsABAP = exports.BuiltIn = exports.MethodLengthStats = exports.LanguageServer = exports.Registry = exports.CyclomaticComplexityStats = exports.ReferenceType = exports.Version = exports.Config = exports.Issue = exports.MemoryFile = void 0;
|
|
37592
|
+
exports.RuleTag = void 0;
|
|
37589
37593
|
const issue_1 = __webpack_require__(/*! ./issue */ "./node_modules/@abaplint/core/build/src/issue.js");
|
|
37590
37594
|
Object.defineProperty(exports, "Issue", ({ enumerable: true, get: function () { return issue_1.Issue; } }));
|
|
37591
37595
|
const config_1 = __webpack_require__(/*! ./config */ "./node_modules/@abaplint/core/build/src/config.js");
|
|
@@ -37681,6 +37685,8 @@ const rules_runner_1 = __webpack_require__(/*! ./rules_runner */ "./node_modules
|
|
|
37681
37685
|
Object.defineProperty(exports, "RulesRunner", ({ enumerable: true, get: function () { return rules_runner_1.RulesRunner; } }));
|
|
37682
37686
|
const _irule_1 = __webpack_require__(/*! ./rules/_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
|
|
37683
37687
|
Object.defineProperty(exports, "RuleTag", ({ enumerable: true, get: function () { return _irule_1.RuleTag; } }));
|
|
37688
|
+
const cyclomatic_complexity_stats_1 = __webpack_require__(/*! ./utils/cyclomatic_complexity_stats */ "./node_modules/@abaplint/core/build/src/utils/cyclomatic_complexity_stats.js");
|
|
37689
|
+
Object.defineProperty(exports, "CyclomaticComplexityStats", ({ enumerable: true, get: function () { return cyclomatic_complexity_stats_1.CyclomaticComplexityStats; } }));
|
|
37684
37690
|
//# sourceMappingURL=index.js.map
|
|
37685
37691
|
|
|
37686
37692
|
/***/ }),
|
|
@@ -44889,7 +44895,7 @@ class Table extends _abstract_object_1.AbstractObject {
|
|
|
44889
44895
|
return new Types.UnknownType("Table/Structure " + this.getName() + " does not contain any components");
|
|
44890
44896
|
}
|
|
44891
44897
|
reg.getDDICReferences().setUsing(this, references);
|
|
44892
|
-
return new Types.StructureType(components, this.getName());
|
|
44898
|
+
return new Types.StructureType(components, this.getName(), this.getName());
|
|
44893
44899
|
}
|
|
44894
44900
|
getTableCategory() {
|
|
44895
44901
|
var _a;
|
|
@@ -45695,7 +45701,6 @@ exports.Position = Position;
|
|
|
45695
45701
|
class VirtualPosition extends Position {
|
|
45696
45702
|
constructor(virtual, row, col) {
|
|
45697
45703
|
super(virtual.getRow(), virtual.getCol());
|
|
45698
|
-
// this.virtual = virtual;
|
|
45699
45704
|
this.vrow = row;
|
|
45700
45705
|
this.vcol = col;
|
|
45701
45706
|
}
|
|
@@ -45703,7 +45708,8 @@ class VirtualPosition extends Position {
|
|
|
45703
45708
|
if (!(p instanceof VirtualPosition)) {
|
|
45704
45709
|
return false;
|
|
45705
45710
|
}
|
|
45706
|
-
|
|
45711
|
+
const casted = p;
|
|
45712
|
+
return super.equals(this) && this.vrow === casted.vrow && this.vcol === casted.vcol;
|
|
45707
45713
|
}
|
|
45708
45714
|
}
|
|
45709
45715
|
exports.VirtualPosition = VirtualPosition;
|
|
@@ -46202,7 +46208,7 @@ class Registry {
|
|
|
46202
46208
|
}
|
|
46203
46209
|
static abaplintVersion() {
|
|
46204
46210
|
// magic, see build script "version.sh"
|
|
46205
|
-
return "2.95.
|
|
46211
|
+
return "2.95.42";
|
|
46206
46212
|
}
|
|
46207
46213
|
getDDICReferences() {
|
|
46208
46214
|
return this.references;
|
|
@@ -50764,6 +50770,7 @@ const include_graph_1 = __webpack_require__(/*! ../utils/include_graph */ "./nod
|
|
|
50764
50770
|
const objects_1 = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
|
|
50765
50771
|
const _builtin_1 = __webpack_require__(/*! ../abap/5_syntax/_builtin */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js");
|
|
50766
50772
|
const _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js");
|
|
50773
|
+
const statements_1 = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
|
|
50767
50774
|
// todo: refactor each sub-rule to new classes?
|
|
50768
50775
|
// todo: add configuration
|
|
50769
50776
|
class DownportConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
@@ -50920,6 +50927,19 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
50920
50927
|
}
|
|
50921
50928
|
return this.graph.listMainForInclude(filename);
|
|
50922
50929
|
}
|
|
50930
|
+
containsError(highObj) {
|
|
50931
|
+
for (const file of highObj.getABAPFiles()) {
|
|
50932
|
+
for (const statement of file.getStatements()) {
|
|
50933
|
+
if (statement.get() instanceof _statement_1.Unknown) {
|
|
50934
|
+
return true; // contains parser errors
|
|
50935
|
+
}
|
|
50936
|
+
}
|
|
50937
|
+
if (file.getStructure() === undefined) {
|
|
50938
|
+
return true;
|
|
50939
|
+
}
|
|
50940
|
+
}
|
|
50941
|
+
return false;
|
|
50942
|
+
}
|
|
50923
50943
|
run(lowObj) {
|
|
50924
50944
|
var _a;
|
|
50925
50945
|
const ret = [];
|
|
@@ -50936,6 +50956,9 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
50936
50956
|
return ret;
|
|
50937
50957
|
}
|
|
50938
50958
|
let highSyntaxObj = highObj;
|
|
50959
|
+
if (this.containsError(highObj)) {
|
|
50960
|
+
return ret;
|
|
50961
|
+
}
|
|
50939
50962
|
// for includes do the syntax check via a main program
|
|
50940
50963
|
if (lowObj instanceof objects_1.Program && lowObj.isInclude()) {
|
|
50941
50964
|
const mains = this.listMainForInclude((_a = lowObj.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getFilename());
|
|
@@ -51169,7 +51192,7 @@ Only one transformation is applied to a statement at a time, so multiple steps m
|
|
|
51169
51192
|
if (found) {
|
|
51170
51193
|
return found;
|
|
51171
51194
|
}
|
|
51172
|
-
found = this.replaceLineFunctions(high, lowFile, highSyntax);
|
|
51195
|
+
found = this.replaceLineFunctions(high, lowFile, highSyntax, highFile);
|
|
51173
51196
|
if (found) {
|
|
51174
51197
|
return found;
|
|
51175
51198
|
}
|
|
@@ -53133,6 +53156,11 @@ ${indentation} output = ${topTarget}.`;
|
|
|
53133
53156
|
if (chain === undefined) {
|
|
53134
53157
|
continue;
|
|
53135
53158
|
}
|
|
53159
|
+
const concat = chain.concatTokens().toUpperCase();
|
|
53160
|
+
if (concat.startsWith("LINE_EXISTS( ") || concat.startsWith("LINE_INDEX( ")) {
|
|
53161
|
+
// these are handled separately
|
|
53162
|
+
continue;
|
|
53163
|
+
}
|
|
53136
53164
|
let predicate = false;
|
|
53137
53165
|
const spag = highSyntax.spaghetti.lookupPosition(high.getFirstToken().getStart(), lowFile.getFilename());
|
|
53138
53166
|
for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {
|
|
@@ -53210,7 +53238,7 @@ ${indentation} output = ${topTarget}.`;
|
|
|
53210
53238
|
}
|
|
53211
53239
|
return undefined;
|
|
53212
53240
|
}
|
|
53213
|
-
replaceLineFunctions(node, lowFile, highSyntax) {
|
|
53241
|
+
replaceLineFunctions(node, lowFile, highSyntax, highFile) {
|
|
53214
53242
|
var _a, _b;
|
|
53215
53243
|
const spag = highSyntax.spaghetti.lookupPosition(node.getFirstToken().getStart(), lowFile.getFilename());
|
|
53216
53244
|
for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {
|
|
@@ -53245,12 +53273,31 @@ ${indentation} output = ${topTarget}.`;
|
|
|
53245
53273
|
indentation + `READ TABLE ${tableName} ${condition}TRANSPORTING NO FIELDS.\n` +
|
|
53246
53274
|
indentation + uniqueName + ` = ${sy}.\n` +
|
|
53247
53275
|
indentation;
|
|
53248
|
-
|
|
53276
|
+
let insertAt = node.getFirstToken().getStart();
|
|
53277
|
+
if (node.get() instanceof statements_1.ElseIf) {
|
|
53278
|
+
// assumption: no side effects in IF conditions
|
|
53279
|
+
insertAt = this.findStartOfIf(node, highFile);
|
|
53280
|
+
if (insertAt === undefined) {
|
|
53281
|
+
continue;
|
|
53282
|
+
}
|
|
53283
|
+
}
|
|
53284
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, insertAt, code);
|
|
53249
53285
|
const start = expression.getFirstToken().getStart();
|
|
53250
53286
|
const end = expression.getLastToken().getEnd();
|
|
53251
53287
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, uniqueName + (func === "LINE_EXISTS" ? " = 0" : ""));
|
|
53252
53288
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
53253
|
-
return issue_1.Issue.atToken(lowFile, token, "
|
|
53289
|
+
return issue_1.Issue.atToken(lowFile, token, "Replace line function", this.getMetadata().key, this.conf.severity, fix);
|
|
53290
|
+
}
|
|
53291
|
+
}
|
|
53292
|
+
return undefined;
|
|
53293
|
+
}
|
|
53294
|
+
findStartOfIf(node, highFile) {
|
|
53295
|
+
const structure = highFile.getStructure();
|
|
53296
|
+
for (const c of (structure === null || structure === void 0 ? void 0 : structure.findAllStructuresRecursive(Structures.If)) || []) {
|
|
53297
|
+
for (const ei of c.findDirectStructures(Structures.ElseIf)) {
|
|
53298
|
+
if (ei.getFirstStatement() === node) {
|
|
53299
|
+
return c.getFirstToken().getStart();
|
|
53300
|
+
}
|
|
53254
53301
|
}
|
|
53255
53302
|
}
|
|
53256
53303
|
return undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.32",
|
|
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.32",
|
|
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.42",
|
|
33
33
|
"progress": "^2.0.3",
|
|
34
34
|
"webpack": "^5.76.1",
|
|
35
35
|
"webpack-cli": "^5.0.1",
|