@abaplint/transpiler-cli 2.5.30 → 2.5.31

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.
Files changed (2) hide show
  1. package/build/bundle.js +40 -15
  2. 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({ qualifiedName: qualifiedName });
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.RuleTag = 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.ReferenceType = exports.Version = exports.Config = exports.Issue = exports.MemoryFile = void 0;
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
- return super.equals(this) && this.vrow === p.vrow && this.vcol === p.vcol;
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.39";
46211
+ return "2.95.41";
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 {
@@ -51169,7 +51176,7 @@ Only one transformation is applied to a statement at a time, so multiple steps m
51169
51176
  if (found) {
51170
51177
  return found;
51171
51178
  }
51172
- found = this.replaceLineFunctions(high, lowFile, highSyntax);
51179
+ found = this.replaceLineFunctions(high, lowFile, highSyntax, highFile);
51173
51180
  if (found) {
51174
51181
  return found;
51175
51182
  }
@@ -53210,7 +53217,7 @@ ${indentation} output = ${topTarget}.`;
53210
53217
  }
53211
53218
  return undefined;
53212
53219
  }
53213
- replaceLineFunctions(node, lowFile, highSyntax) {
53220
+ replaceLineFunctions(node, lowFile, highSyntax, highFile) {
53214
53221
  var _a, _b;
53215
53222
  const spag = highSyntax.spaghetti.lookupPosition(node.getFirstToken().getStart(), lowFile.getFilename());
53216
53223
  for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {
@@ -53245,12 +53252,30 @@ ${indentation} output = ${topTarget}.`;
53245
53252
  indentation + `READ TABLE ${tableName} ${condition}TRANSPORTING NO FIELDS.\n` +
53246
53253
  indentation + uniqueName + ` = ${sy}.\n` +
53247
53254
  indentation;
53248
- const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);
53255
+ let insertAt = node.getFirstToken().getStart();
53256
+ if (node.get() instanceof statements_1.ElseIf) {
53257
+ // assumption: no side effects in IF conditions
53258
+ insertAt = this.findStartOfIf(node, highFile);
53259
+ if (insertAt === undefined) {
53260
+ continue;
53261
+ }
53262
+ }
53263
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, insertAt, code);
53249
53264
  const start = expression.getFirstToken().getStart();
53250
53265
  const end = expression.getLastToken().getEnd();
53251
53266
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, uniqueName + (func === "LINE_EXISTS" ? " = 0" : ""));
53252
53267
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
53253
- return issue_1.Issue.atToken(lowFile, token, "Use BOOLC", this.getMetadata().key, this.conf.severity, fix);
53268
+ return issue_1.Issue.atToken(lowFile, token, "Replace line function", this.getMetadata().key, this.conf.severity, fix);
53269
+ }
53270
+ }
53271
+ return undefined;
53272
+ }
53273
+ findStartOfIf(node, highFile) {
53274
+ var _a;
53275
+ const structure = highFile.getStructure();
53276
+ for (const c of (structure === null || structure === void 0 ? void 0 : structure.findAllStructuresRecursive(Structures.If)) || []) {
53277
+ if (((_a = c.findDirectStructure(Structures.ElseIf)) === null || _a === void 0 ? void 0 : _a.getFirstStatement()) === node) {
53278
+ return c.getFirstToken().getStart();
53254
53279
  }
53255
53280
  }
53256
53281
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.5.30",
3
+ "version": "2.5.31",
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.30",
28
+ "@abaplint/transpiler": "^2.5.31",
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.39",
32
+ "@abaplint/core": "^2.95.41",
33
33
  "progress": "^2.0.3",
34
34
  "webpack": "^5.76.1",
35
35
  "webpack-cli": "^5.0.1",