@abaplint/transpiler-cli 2.6.39 → 2.6.41

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 +163 -13
  2. package/package.json +4 -4
package/build/bundle.js CHANGED
@@ -19653,6 +19653,9 @@ class CurrentScope {
19653
19653
  return undefined;
19654
19654
  }
19655
19655
  const typePoolName = name.split("_")[0];
19656
+ if (typePoolName.length <= 2 || typePoolName.length > 5) {
19657
+ return undefined;
19658
+ }
19656
19659
  const typePool = this.reg.getObject("TYPE", typePoolName);
19657
19660
  if (typePool === undefined) {
19658
19661
  return undefined;
@@ -19667,6 +19670,14 @@ class CurrentScope {
19667
19670
  return undefined;
19668
19671
  }
19669
19672
  const typePoolName = name.split("_")[0];
19673
+ if (typePoolName.length <= 2 || typePoolName.length > 5) {
19674
+ return undefined;
19675
+ }
19676
+ if (new ddic_1.DDIC(this.reg).lookupNoVoid(name) !== undefined) {
19677
+ // this is tricky, it should not do recursion when parsing the type pool itself,
19678
+ // think about DTEL ABAP_ENCOD vs TYPE ABAP
19679
+ return undefined;
19680
+ }
19670
19681
  const typePool = this.reg.getObject("TYPE", typePoolName);
19671
19682
  if (typePool === undefined) {
19672
19683
  return undefined;
@@ -20593,7 +20604,7 @@ class TypeUtils {
20593
20604
  return false;
20594
20605
  }
20595
20606
  isAssignableStrict(source, target) {
20596
- var _a, _b;
20607
+ var _a, _b, _c, _d;
20597
20608
  /*
20598
20609
  console.dir(source);
20599
20610
  console.dir(target);
@@ -20612,6 +20623,20 @@ class TypeUtils {
20612
20623
  return false;
20613
20624
  }
20614
20625
  }
20626
+ else if (source instanceof basic_1.HexType) {
20627
+ if (target instanceof basic_1.HexType) {
20628
+ if (((_c = source.getAbstractTypeData()) === null || _c === void 0 ? void 0 : _c.derivedFromConstant) === true) {
20629
+ return source.getLength() <= target.getLength();
20630
+ }
20631
+ return source.getLength() === target.getLength();
20632
+ }
20633
+ else if (target instanceof basic_1.IntegerType) {
20634
+ if (((_d = source.getAbstractTypeData()) === null || _d === void 0 ? void 0 : _d.derivedFromConstant) === true) {
20635
+ return true;
20636
+ }
20637
+ return false;
20638
+ }
20639
+ }
20615
20640
  else if (source instanceof basic_1.StringType && target instanceof basic_1.StructureType) {
20616
20641
  if (this.structureContainsString(target)) {
20617
20642
  return false;
@@ -20948,7 +20973,7 @@ class BasicTypes {
20948
20973
  if (type instanceof basic_1.CharacterType
20949
20974
  && qualifiedName
20950
20975
  && qualifiedName.includes("-") === false) {
20951
- type = type.cloneType(qualifiedName);
20976
+ type = type.cloneType({ qualifiedName });
20952
20977
  }
20953
20978
  return type;
20954
20979
  }
@@ -22640,10 +22665,26 @@ class FieldChain {
22640
22665
  context = new attribute_name_1.AttributeName().runSyntax(context, current, scope, filename, refType);
22641
22666
  }
22642
22667
  else if (current.get() instanceof Expressions.FieldOffset && current instanceof nodes_1.ExpressionNode) {
22643
- new field_offset_1.FieldOffset().runSyntax(current, scope, filename);
22668
+ const offset = new field_offset_1.FieldOffset().runSyntax(current, scope, filename);
22669
+ if (offset) {
22670
+ if (context instanceof basic_1.CharacterType) {
22671
+ context = new basic_1.CharacterType(context.getLength() - offset);
22672
+ }
22673
+ else if (context instanceof basic_1.HexType) {
22674
+ context = new basic_1.HexType(context.getLength() - offset);
22675
+ }
22676
+ }
22644
22677
  }
22645
22678
  else if (current.get() instanceof Expressions.FieldLength && current instanceof nodes_1.ExpressionNode) {
22646
- new field_length_1.FieldLength().runSyntax(current, scope, filename);
22679
+ const length = new field_length_1.FieldLength().runSyntax(current, scope, filename);
22680
+ if (length) {
22681
+ if (context instanceof basic_1.CharacterType) {
22682
+ context = new basic_1.CharacterType(length);
22683
+ }
22684
+ else if (context instanceof basic_1.HexType) {
22685
+ context = new basic_1.HexType(length);
22686
+ }
22687
+ }
22647
22688
  }
22648
22689
  }
22649
22690
  return context;
@@ -22706,6 +22747,15 @@ class FieldLength {
22706
22747
  const field = node.findDirectExpression(Expressions.SimpleFieldChain2);
22707
22748
  if (field) {
22708
22749
  new field_chain_1.FieldChain().runSyntax(field, scope, filename, _reference_1.ReferenceType.DataReadReference);
22750
+ return undefined;
22751
+ }
22752
+ else {
22753
+ const children = node.getChildren();
22754
+ const num = children[children.length - 2];
22755
+ if (num.getLastToken().getStr() === "*") {
22756
+ return undefined;
22757
+ }
22758
+ return parseInt(num.getLastToken().getStr(), 10);
22709
22759
  }
22710
22760
  }
22711
22761
  }
@@ -22732,6 +22782,10 @@ class FieldOffset {
22732
22782
  const field = node.findDirectExpression(Expressions.SimpleFieldChain2);
22733
22783
  if (field) {
22734
22784
  new field_chain_1.FieldChain().runSyntax(field, scope, filename, _reference_1.ReferenceType.DataReadReference);
22785
+ return undefined;
22786
+ }
22787
+ else {
22788
+ return parseInt(node.getLastToken().getStr(), 10);
22735
22789
  }
22736
22790
  }
22737
22791
  }
@@ -32928,13 +32982,16 @@ class CharacterType extends _abstract_type_1.AbstractType {
32928
32982
  }
32929
32983
  this.length = length;
32930
32984
  }
32931
- cloneType(qualifiedName, ddicName) {
32985
+ cloneType(input) {
32932
32986
  const clone = Object.assign({}, this.getAbstractTypeData()) || {};
32933
- if (qualifiedName) {
32934
- clone.qualifiedName = qualifiedName;
32987
+ if (input.qualifiedName) {
32988
+ clone.qualifiedName = input.qualifiedName;
32989
+ }
32990
+ if (input.ddicName) {
32991
+ clone.ddicName = input.ddicName;
32935
32992
  }
32936
- if (ddicName) {
32937
- clone.ddicName = ddicName;
32993
+ if (input.derivedFromConstant) {
32994
+ clone.derivedFromConstant = input.derivedFromConstant;
32938
32995
  }
32939
32996
  return new CharacterType(this.length, clone);
32940
32997
  }
@@ -43648,6 +43705,10 @@ class MIMEObject extends _abstract_object_1.AbstractObject {
43648
43705
  this.parse();
43649
43706
  return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.CLASS;
43650
43707
  }
43708
+ isFolder() {
43709
+ var _a;
43710
+ return ((_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.FOLDER) === "X";
43711
+ }
43651
43712
  getAllowedNaming() {
43652
43713
  return {
43653
43714
  maxLength: 32,
@@ -43685,6 +43746,7 @@ class MIMEObject extends _abstract_object_1.AbstractObject {
43685
43746
  }
43686
43747
  this.parsedXML.URL = parsed.abapGit["asx:abap"]["asx:values"].URL;
43687
43748
  this.parsedXML.CLASS = parsed.abapGit["asx:abap"]["asx:values"].CLASS;
43749
+ this.parsedXML.FOLDER = parsed.abapGit["asx:abap"]["asx:values"].FOLDER;
43688
43750
  const end = Date.now();
43689
43751
  return { updated: true, runtime: end - start };
43690
43752
  }
@@ -46550,7 +46612,7 @@ class Registry {
46550
46612
  }
46551
46613
  static abaplintVersion() {
46552
46614
  // magic, see build script "version.sh"
46553
- return "2.98.3";
46615
+ return "2.99.4";
46554
46616
  }
46555
46617
  getDDICReferences() {
46556
46618
  return this.references;
@@ -56538,6 +56600,7 @@ __exportStar(__webpack_require__(/*! ./sequential_blank */ "./node_modules/@abap
56538
56600
  __exportStar(__webpack_require__(/*! ./short_case */ "./node_modules/@abaplint/core/build/src/rules/short_case.js"), exports);
56539
56601
  __exportStar(__webpack_require__(/*! ./sicf_consistency */ "./node_modules/@abaplint/core/build/src/rules/sicf_consistency.js"), exports);
56540
56602
  __exportStar(__webpack_require__(/*! ./slow_parameter_passing */ "./node_modules/@abaplint/core/build/src/rules/slow_parameter_passing.js"), exports);
56603
+ __exportStar(__webpack_require__(/*! ./smim_consistency */ "./node_modules/@abaplint/core/build/src/rules/smim_consistency.js"), exports);
56541
56604
  __exportStar(__webpack_require__(/*! ./space_before_colon */ "./node_modules/@abaplint/core/build/src/rules/space_before_colon.js"), exports);
56542
56605
  __exportStar(__webpack_require__(/*! ./space_before_dot */ "./node_modules/@abaplint/core/build/src/rules/space_before_dot.js"), exports);
56543
56606
  __exportStar(__webpack_require__(/*! ./sql_escape_host_variables */ "./node_modules/@abaplint/core/build/src/rules/sql_escape_host_variables.js"), exports);
@@ -60557,6 +60620,7 @@ const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/co
60557
60620
  const Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
60558
60621
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
60559
60622
  const statements_1 = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
60623
+ const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
60560
60624
  class OmitPrecedingZerosConf extends _basic_rule_config_1.BasicRuleConfig {
60561
60625
  }
60562
60626
  exports.OmitPrecedingZerosConf = OmitPrecedingZerosConf;
@@ -60570,7 +60634,7 @@ class OmitPrecedingZeros extends _abap_rule_1.ABAPRule {
60570
60634
  key: "omit_preceding_zeros",
60571
60635
  title: "Omit preceding zeros",
60572
60636
  shortDescription: `Omit preceding zeros from integer constants`,
60573
- tags: [_irule_1.RuleTag.SingleFile],
60637
+ tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
60574
60638
  badExample: `int = -001.`,
60575
60639
  goodExample: `int = -1.`,
60576
60640
  };
@@ -60582,7 +60646,9 @@ class OmitPrecedingZeros extends _abap_rule_1.ABAPRule {
60582
60646
  this.conf = conf;
60583
60647
  }
60584
60648
  runParsed(file) {
60649
+ var _a;
60585
60650
  const issues = [];
60651
+ const message = "Omit preceding zeros";
60586
60652
  for (const s of file.getStatements()) {
60587
60653
  for (const i of s.findAllExpressions(Expressions.Integer)) {
60588
60654
  const token = i.getLastToken();
@@ -60591,8 +60657,19 @@ class OmitPrecedingZeros extends _abap_rule_1.ABAPRule {
60591
60657
  if (s.get() instanceof statements_1.CallScreen || s.get() instanceof statements_1.SetScreen) {
60592
60658
  continue;
60593
60659
  }
60594
- const message = "Omit preceding zeros";
60595
- const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.getConfig().severity);
60660
+ const replace = str.replace(/^0+/, "");
60661
+ const fix = edit_helper_1.EditHelper.replaceRange(file, token.getStart(), token.getEnd(), replace);
60662
+ const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.getConfig().severity, fix);
60663
+ issues.push(issue);
60664
+ }
60665
+ }
60666
+ for (const i of s.findAllExpressions(Expressions.ParameterException)) {
60667
+ const token = (_a = i.findDirectExpression(Expressions.SimpleName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
60668
+ const str = token === null || token === void 0 ? void 0 : token.getStr();
60669
+ if (token && str && str.length > 1 && str.startsWith("0")) {
60670
+ const replace = str.replace(/^0+/, "");
60671
+ const fix = edit_helper_1.EditHelper.replaceRange(file, token.getStart(), token.getEnd(), replace);
60672
+ const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.getConfig().severity, fix);
60596
60673
  issues.push(issue);
60597
60674
  }
60598
60675
  }
@@ -63288,6 +63365,79 @@ exports.SlowParameterPassing = SlowParameterPassing;
63288
63365
 
63289
63366
  /***/ }),
63290
63367
 
63368
+ /***/ "./node_modules/@abaplint/core/build/src/rules/smim_consistency.js":
63369
+ /*!*************************************************************************!*\
63370
+ !*** ./node_modules/@abaplint/core/build/src/rules/smim_consistency.js ***!
63371
+ \*************************************************************************/
63372
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
63373
+
63374
+ "use strict";
63375
+
63376
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
63377
+ exports.SMIMConsistency = exports.SMIMConsistencyConf = void 0;
63378
+ const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
63379
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
63380
+ const objects_1 = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
63381
+ const position_1 = __webpack_require__(/*! ../position */ "./node_modules/@abaplint/core/build/src/position.js");
63382
+ class SMIMConsistencyConf extends _basic_rule_config_1.BasicRuleConfig {
63383
+ }
63384
+ exports.SMIMConsistencyConf = SMIMConsistencyConf;
63385
+ class SMIMConsistency {
63386
+ constructor() {
63387
+ this.conf = new SMIMConsistencyConf();
63388
+ }
63389
+ getMetadata() {
63390
+ return {
63391
+ key: "smim_consistency",
63392
+ title: "SMIM consistency check",
63393
+ shortDescription: `SMIM consistency check`,
63394
+ extendedInformation: "Check folders exists",
63395
+ };
63396
+ }
63397
+ getConfig() {
63398
+ return this.conf;
63399
+ }
63400
+ setConfig(conf) {
63401
+ this.conf = conf;
63402
+ }
63403
+ initialize(reg) {
63404
+ this.reg = reg;
63405
+ return this;
63406
+ }
63407
+ run(obj) {
63408
+ const issues = [];
63409
+ if (!(obj instanceof objects_1.MIMEObject)) {
63410
+ return [];
63411
+ }
63412
+ const base = this.base(obj.getURL() || "");
63413
+ if (base !== "" && this.findFolder(base) === false) {
63414
+ const message = `Parent folder "${base}" not found`;
63415
+ const position = new position_1.Position(1, 1);
63416
+ const issue = issue_1.Issue.atPosition(obj.getFiles()[0], position, message, this.getMetadata().key, this.conf.severity);
63417
+ issues.push(issue);
63418
+ }
63419
+ return issues;
63420
+ }
63421
+ base(full) {
63422
+ const components = full.split("/");
63423
+ components.pop();
63424
+ return components.join("/");
63425
+ }
63426
+ findFolder(base) {
63427
+ for (const smim of this.reg.getObjectsByType("SMIM")) {
63428
+ const mime = smim;
63429
+ if (base === mime.getURL() && mime.isFolder() === true) {
63430
+ return true;
63431
+ }
63432
+ }
63433
+ return false;
63434
+ }
63435
+ }
63436
+ exports.SMIMConsistency = SMIMConsistency;
63437
+ //# sourceMappingURL=smim_consistency.js.map
63438
+
63439
+ /***/ }),
63440
+
63291
63441
  /***/ "./node_modules/@abaplint/core/build/src/rules/space_before_colon.js":
63292
63442
  /*!***************************************************************************!*\
63293
63443
  !*** ./node_modules/@abaplint/core/build/src/rules/space_before_colon.js ***!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.6.39",
3
+ "version": "2.6.41",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "bin": {
6
6
  "abap_transpile": "./abap_transpile"
@@ -25,12 +25,12 @@
25
25
  "author": "abaplint",
26
26
  "license": "MIT",
27
27
  "devDependencies": {
28
- "@abaplint/transpiler": "^2.6.39",
28
+ "@abaplint/transpiler": "^2.6.41",
29
29
  "@types/glob": "^7.2.0",
30
30
  "glob": "=7.2.0",
31
31
  "@types/progress": "^2.0.5",
32
- "@types/node": "^18.16.2",
33
- "@abaplint/core": "^2.98.3",
32
+ "@types/node": "^18.16.3",
33
+ "@abaplint/core": "^2.99.4",
34
34
  "progress": "^2.0.3",
35
35
  "webpack": "^5.81.0",
36
36
  "webpack-cli": "^5.0.2",