@abaplint/core 2.101.15 → 2.101.16

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.
@@ -441,6 +441,7 @@ declare namespace BasicTypes {
441
441
  UnknownType,
442
442
  UTCLongType,
443
443
  VoidType,
444
+ XGenericType,
444
445
  XSequenceType,
445
446
  XStringType
446
447
  }
@@ -6793,6 +6794,14 @@ declare class WStaticArrowW extends Token {
6793
6794
  static railroad(): string;
6794
6795
  }
6795
6796
 
6797
+ declare class XGenericType extends AbstractType {
6798
+ toText(): string;
6799
+ isGeneric(): boolean;
6800
+ toABAP(): string;
6801
+ containsVoid(): boolean;
6802
+ toCDS(): string;
6803
+ }
6804
+
6796
6805
  declare class XSequenceType extends AbstractType {
6797
6806
  toText(): string;
6798
6807
  isGeneric(): boolean;
@@ -92,6 +92,7 @@ class TypeUtils {
92
92
  else if (type instanceof basic_1.XStringType
93
93
  || type instanceof basic_1.HexType
94
94
  || type instanceof basic_1.VoidType
95
+ || type instanceof basic_1.XGenericType
95
96
  || type instanceof basic_1.XSequenceType
96
97
  || type instanceof basic_1.AnyType
97
98
  || type instanceof basic_1.UnknownType) {
@@ -24,7 +24,7 @@ class BasicTypes {
24
24
  }
25
25
  lookupQualifiedName(name) {
26
26
  var _a;
27
- // argh, todo, rewrite this entire method, more argh
27
+ // argh, todo, rewrite this entire method, more argh, again argh
28
28
  if (name === undefined) {
29
29
  return undefined;
30
30
  }
@@ -45,7 +45,10 @@ class BasicTypes {
45
45
  const stru = oo.getTypeDefinitions().getByName(subTypeName);
46
46
  const struType = stru === null || stru === void 0 ? void 0 : stru.getType();
47
47
  if (stru && struType instanceof basic_1.StructureType) {
48
- const f = struType.getComponentByName(fieldName);
48
+ let f = struType.getComponentByName(fieldName);
49
+ if (split[2] && f instanceof basic_1.StructureType) {
50
+ f = f.getComponentByName(split[2]);
51
+ }
49
52
  if (f) {
50
53
  return new _typed_identifier_1.TypedIdentifier(stru.getToken(), stru.getFilename(), f);
51
54
  }
@@ -67,7 +70,10 @@ class BasicTypes {
67
70
  if (type) {
68
71
  const stru = type.getType();
69
72
  if (stru instanceof basic_1.StructureType) {
70
- const f = stru.getComponentByName(fieldName);
73
+ let f = stru.getComponentByName(fieldName);
74
+ if (split[2] && f instanceof basic_1.StructureType) {
75
+ f = f.getComponentByName(split[2]);
76
+ }
71
77
  if (f) {
72
78
  return new _typed_identifier_1.TypedIdentifier(type.getToken(), type.getFilename(), f);
73
79
  }
@@ -30,6 +30,9 @@ class MethodParam {
30
30
  if (concat === "TYPE C" || concat.startsWith("TYPE C ")) {
31
31
  return new _typed_identifier_1.TypedIdentifier(name.getFirstToken(), filename, new cgeneric_type_1.CGenericType(), meta);
32
32
  }
33
+ else if (concat === "TYPE X" || concat.startsWith("TYPE X ")) {
34
+ return new _typed_identifier_1.TypedIdentifier(name.getFirstToken(), filename, new basic_1.XGenericType(), meta);
35
+ }
33
36
  const found = new basic_types_1.BasicTypes(filename, scope).parseType(type);
34
37
  if (found) {
35
38
  return new _typed_identifier_1.TypedIdentifier(name.getFirstToken(), filename, found, meta);
@@ -6,7 +6,7 @@ class HexType extends _abstract_type_1.AbstractType {
6
6
  constructor(length, qualifiedName) {
7
7
  super({ qualifiedName: qualifiedName });
8
8
  if (length <= 0) {
9
- throw new Error("Bad LENGTHm, Hex");
9
+ throw new Error("Bad LENGTH, Hex");
10
10
  }
11
11
  this.length = length;
12
12
  }
@@ -42,6 +42,7 @@ __exportStar(require("./time_type"), exports);
42
42
  __exportStar(require("./unknown_type"), exports);
43
43
  __exportStar(require("./utc_long_type"), exports);
44
44
  __exportStar(require("./void_type"), exports);
45
+ __exportStar(require("./xgeneric_type"), exports);
45
46
  __exportStar(require("./xsequence_type"), exports);
46
47
  __exportStar(require("./xstring_type"), exports);
47
48
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.XGenericType = void 0;
4
+ const _abstract_type_1 = require("./_abstract_type");
5
+ class XGenericType extends _abstract_type_1.AbstractType {
6
+ toText() {
7
+ return "```x```";
8
+ }
9
+ isGeneric() {
10
+ return true;
11
+ }
12
+ toABAP() {
13
+ throw new Error("x, generic");
14
+ }
15
+ containsVoid() {
16
+ return false;
17
+ }
18
+ toCDS() {
19
+ return "abap.TODO_CGENERIC";
20
+ }
21
+ }
22
+ exports.XGenericType = XGenericType;
23
+ //# sourceMappingURL=xgeneric_type.js.map
@@ -65,7 +65,7 @@ class Registry {
65
65
  }
66
66
  static abaplintVersion() {
67
67
  // magic, see build script "version.sh"
68
- return "2.101.15";
68
+ return "2.101.16";
69
69
  }
70
70
  getDDICReferences() {
71
71
  return this.ddicReferences;
@@ -6,7 +6,9 @@ const Expressions = require("../abap/2_statements/expressions");
6
6
  const _abap_rule_1 = require("./_abap_rule");
7
7
  const _basic_rule_config_1 = require("./_basic_rule_config");
8
8
  const _irule_1 = require("./_irule");
9
+ const position_1 = require("../position");
9
10
  const __1 = require("..");
11
+ const edit_helper_1 = require("../edit_helper");
10
12
  class AlignParametersConf extends _basic_rule_config_1.BasicRuleConfig {
11
13
  }
12
14
  exports.AlignParametersConf = AlignParametersConf;
@@ -33,7 +35,8 @@ https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#align-par
33
35
 
34
36
  Does not take effect on non functional method calls, use https://rules.abaplint.org/functional_writing/
35
37
 
36
- Also https://rules.abaplint.org/max_one_method_parameter_per_line/ can help aligning parameter syntax`,
38
+ If parameters are on the same row, no issues are reported, see
39
+ https://rules.abaplint.org/max_one_method_parameter_per_line/ for splitting parameters to lines`,
37
40
  tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Styleguide],
38
41
  badExample: `CALL FUNCTION 'FOOBAR'
39
42
  EXPORTING
@@ -96,16 +99,28 @@ DATA(sdf) = VALUE type(
96
99
  return undefined;
97
100
  }
98
101
  let expectedEqualsColumn = 0;
102
+ let row = 0;
99
103
  for (const p of candidate.parameters) {
100
104
  const currentCol = p.left.getLastToken().getCol() + p.left.getLastToken().getStr().length + 1;
105
+ if (p.eq.getRow() === row) {
106
+ return undefined;
107
+ }
108
+ row = p.eq.getRow();
101
109
  if (currentCol > expectedEqualsColumn) {
102
110
  expectedEqualsColumn = currentCol;
103
111
  }
104
112
  }
105
113
  for (const p of candidate.parameters) {
106
114
  if (p.eq.getCol() !== expectedEqualsColumn) {
115
+ let fix;
116
+ if (p.eq.getCol() < expectedEqualsColumn) {
117
+ fix = edit_helper_1.EditHelper.insertAt(file, p.eq, " ".repeat(expectedEqualsColumn - p.eq.getCol()));
118
+ }
119
+ else {
120
+ fix = edit_helper_1.EditHelper.deleteRange(file, new position_1.Position(p.eq.getRow(), expectedEqualsColumn), p.eq);
121
+ }
107
122
  const message = "Align parameters to column " + expectedEqualsColumn;
108
- return issue_1.Issue.atPosition(file, p.eq, message, this.getMetadata().key, this.getConfig().severity);
123
+ return issue_1.Issue.atPosition(file, p.eq, message, this.getMetadata().key, this.getConfig().severity, fix);
109
124
  }
110
125
  }
111
126
  return undefined;
@@ -45,11 +45,11 @@ DATA lt_bar TYPE STANDARD TABLE OF ty.`,
45
45
  const concat = tt.concatTokens().toUpperCase();
46
46
  if (concat.includes("TYPE TABLE OF")) {
47
47
  const message = "Specify table type";
48
- issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
48
+ issues.push(issue_1.Issue.atPosition(file, tt.getFirstToken().getStart(), message, this.getMetadata().key, this.conf.severity));
49
49
  }
50
50
  else if (concat.includes(" WITH ") === false && concat.includes(" RANGE OF ") === false) {
51
51
  const message = "Specify table key";
52
- issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
52
+ issues.push(issue_1.Issue.atPosition(file, tt.getFirstToken().getStart(), message, this.getMetadata().key, this.conf.severity));
53
53
  }
54
54
  }
55
55
  return issues;
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SelectSingleFullKey = exports.SelectSingleFullKeyConf = void 0;
4
4
  const issue_1 = require("../issue");
5
5
  const _basic_rule_config_1 = require("./_basic_rule_config");
6
- const _irule_1 = require("./_irule");
7
6
  const __1 = require("..");
8
7
  class SelectSingleFullKeyConf extends _basic_rule_config_1.BasicRuleConfig {
9
8
  constructor() {
@@ -23,7 +22,7 @@ class SelectSingleFullKey {
23
22
  shortDescription: `Detect SELECT SINGLE which are possibily not unique`,
24
23
  extendedInformation: `Table definitions must be known, ie. inside the errorNamespace`,
25
24
  pseudoComment: "EC CI_NOORDER",
26
- tags: [_irule_1.RuleTag.Experimental],
25
+ tags: [],
27
26
  };
28
27
  }
29
28
  initialize(reg) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.101.15",
3
+ "version": "2.101.16",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "homepage": "https://abaplint.org",
52
52
  "devDependencies": {
53
- "@microsoft/api-extractor": "^7.35.1",
53
+ "@microsoft/api-extractor": "^7.35.2",
54
54
  "@types/chai": "^4.3.5",
55
55
  "@types/mocha": "^10.0.1",
56
56
  "@types/node": "^20.2.5",