@abaplint/core 2.101.9 → 2.101.10

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.
@@ -53,6 +53,6 @@ class StructureParser {
53
53
  return { issues: [], node: parent };
54
54
  }
55
55
  }
56
- StructureParser.singletons = {};
57
56
  exports.StructureParser = StructureParser;
57
+ StructureParser.singletons = {};
58
58
  //# sourceMappingURL=structure_parser.js.map
@@ -7,24 +7,24 @@ var AttributeLevel;
7
7
  AttributeLevel["Instance"] = "instance";
8
8
  AttributeLevel["Static"] = "static";
9
9
  AttributeLevel["Constant"] = "constant";
10
- })(AttributeLevel = exports.AttributeLevel || (exports.AttributeLevel = {}));
10
+ })(AttributeLevel || (exports.AttributeLevel = AttributeLevel = {}));
11
11
  var MethodParameterDirection;
12
12
  (function (MethodParameterDirection) {
13
13
  MethodParameterDirection["Importing"] = "importing";
14
14
  MethodParameterDirection["Exporting"] = "exporting";
15
15
  MethodParameterDirection["Changing"] = "changing";
16
16
  MethodParameterDirection["Returning"] = "returning";
17
- })(MethodParameterDirection = exports.MethodParameterDirection || (exports.MethodParameterDirection = {}));
17
+ })(MethodParameterDirection || (exports.MethodParameterDirection = MethodParameterDirection = {}));
18
18
  var Duration;
19
19
  (function (Duration) {
20
20
  Duration["short"] = "SHORT";
21
21
  Duration["medium"] = "MEDIUM";
22
22
  Duration["long"] = "LONG";
23
- })(Duration = exports.Duration || (exports.Duration = {}));
23
+ })(Duration || (exports.Duration = Duration = {}));
24
24
  var RiskLevel;
25
25
  (function (RiskLevel) {
26
26
  RiskLevel["harmless"] = "HARMLESS";
27
27
  RiskLevel["critical"] = "CRITICAL";
28
28
  RiskLevel["dangerous"] = "DANGEROUS";
29
- })(RiskLevel = exports.RiskLevel || (exports.RiskLevel = {}));
29
+ })(RiskLevel || (exports.RiskLevel = RiskLevel = {}));
30
30
  //# sourceMappingURL=_abap_file_information.js.map
@@ -6,5 +6,5 @@ var Visibility;
6
6
  Visibility[Visibility["Private"] = 1] = "Private";
7
7
  Visibility[Visibility["Protected"] = 2] = "Protected";
8
8
  Visibility[Visibility["Public"] = 3] = "Public";
9
- })(Visibility = exports.Visibility || (exports.Visibility = {}));
9
+ })(Visibility || (exports.Visibility = Visibility = {}));
10
10
  //# sourceMappingURL=visibility.js.map
@@ -354,6 +354,7 @@ class BuiltIn {
354
354
  return new _typed_identifier_1.TypedIdentifier(id, BuiltIn.filename, new basic_1.VoidType(name), ["built-in" /* IdentifierMeta.BuiltIn */]);
355
355
  }
356
356
  }
357
+ exports.BuiltIn = BuiltIn;
357
358
  BuiltIn.filename = "_builtin.prog.abap";
358
359
  // todo: "pcre" vs "regex", only one of these parameters are allowed
359
360
  // todo: "pcre", only possible from 755
@@ -1177,5 +1178,4 @@ BuiltIn.methods = [
1177
1178
  return: new basic_1.IntegerType(),
1178
1179
  },
1179
1180
  ];
1180
- exports.BuiltIn = BuiltIn;
1181
1181
  //# sourceMappingURL=_builtin.js.map
@@ -20,5 +20,5 @@ var ReferenceType;
20
20
  // FormVoidReference = "Form (void)",
21
21
  ReferenceType["DataReadReference"] = "Read From";
22
22
  ReferenceType["DataWriteReference"] = "Write To";
23
- })(ReferenceType = exports.ReferenceType || (exports.ReferenceType = {}));
23
+ })(ReferenceType || (exports.ReferenceType = ReferenceType = {}));
24
24
  //# sourceMappingURL=_reference.js.map
@@ -19,5 +19,5 @@ var ScopeType;
19
19
  ScopeType["For"] = "for";
20
20
  ScopeType["Let"] = "let";
21
21
  ScopeType["OpenSQL"] = "open_sql";
22
- })(ScopeType = exports.ScopeType || (exports.ScopeType = {}));
22
+ })(ScopeType || (exports.ScopeType = ScopeType = {}));
23
23
  //# sourceMappingURL=_scope_type.js.map
@@ -9,13 +9,13 @@ var TableAccessType;
9
9
  TableAccessType["hashed"] = "HASHED";
10
10
  TableAccessType["index"] = "INDEX";
11
11
  TableAccessType["any"] = "ANY";
12
- })(TableAccessType = exports.TableAccessType || (exports.TableAccessType = {}));
12
+ })(TableAccessType || (exports.TableAccessType = TableAccessType = {}));
13
13
  var TableKeyType;
14
14
  (function (TableKeyType) {
15
15
  TableKeyType["default"] = "DEFAULT";
16
16
  TableKeyType["user"] = "USER";
17
17
  TableKeyType["empty"] = "EMPTY";
18
- })(TableKeyType = exports.TableKeyType || (exports.TableKeyType = {}));
18
+ })(TableKeyType || (exports.TableKeyType = TableKeyType = {}));
19
19
  class TableType extends _abstract_type_1.AbstractType {
20
20
  constructor(rowType, options, qualifiedName) {
21
21
  var _a;
@@ -8,7 +8,7 @@ var FunctionModuleParameterDirection;
8
8
  FunctionModuleParameterDirection["exporting"] = "exporting";
9
9
  FunctionModuleParameterDirection["changing"] = "changing";
10
10
  FunctionModuleParameterDirection["tables"] = "tables";
11
- })(FunctionModuleParameterDirection = exports.FunctionModuleParameterDirection || (exports.FunctionModuleParameterDirection = {}));
11
+ })(FunctionModuleParameterDirection || (exports.FunctionModuleParameterDirection = FunctionModuleParameterDirection = {}));
12
12
  class FunctionModuleDefinition {
13
13
  constructor(data) {
14
14
  this.parse(data);
@@ -10,7 +10,7 @@ var DDLKind;
10
10
  (function (DDLKind) {
11
11
  DDLKind["Structure"] = "structure";
12
12
  DDLKind["Table"] = "table";
13
- })(DDLKind = exports.DDLKind || (exports.DDLKind = {}));
13
+ })(DDLKind || (exports.DDLKind = DDLKind = {}));
14
14
  class DDLParser {
15
15
  parse(file) {
16
16
  const tokens = ddl_lexer_1.DDLLexer.run(file);
@@ -16,7 +16,7 @@ var RenameType;
16
16
  RenameType[RenameType["Variable"] = 2] = "Variable";
17
17
  RenameType[RenameType["GlobalInterface"] = 3] = "GlobalInterface";
18
18
  RenameType[RenameType["Method"] = 4] = "Method";
19
- })(RenameType = exports.RenameType || (exports.RenameType = {}));
19
+ })(RenameType || (exports.RenameType = RenameType = {}));
20
20
  class Rename {
21
21
  constructor(reg) {
22
22
  this.reg = reg;
@@ -35,18 +35,23 @@ class Rename {
35
35
  return undefined;
36
36
  }
37
37
  const range = _lsp_utils_1.LSPUtils.tokenToRange(cursor.token);
38
+ let placeholder = cursor.token.getStr();
39
+ if (placeholder.startsWith("!")) {
40
+ placeholder = placeholder.substring(1);
41
+ range.start.character += 1;
42
+ }
38
43
  const lookup = _lookup_1.LSPLookup.lookup(cursor, this.reg, obj);
39
44
  if ((lookup === null || lookup === void 0 ? void 0 : lookup.definitionId) instanceof _typed_identifier_1.TypedIdentifier) {
40
- return { range, placeholder: cursor.token.getStr(), type: RenameType.Variable, file };
45
+ return { range, placeholder, type: RenameType.Variable, file };
41
46
  }
42
47
  else if ((lookup === null || lookup === void 0 ? void 0 : lookup.definitionId) instanceof types_1.ClassDefinition) {
43
- return { range, placeholder: cursor.token.getStr(), type: RenameType.GlobalClass, file };
48
+ return { range, placeholder, type: RenameType.GlobalClass, file };
44
49
  }
45
50
  else if ((lookup === null || lookup === void 0 ? void 0 : lookup.definitionId) instanceof types_1.InterfaceDefinition) {
46
- return { range, placeholder: cursor.token.getStr(), type: RenameType.GlobalInterface, file };
51
+ return { range, placeholder, type: RenameType.GlobalInterface, file };
47
52
  }
48
53
  else if ((lookup === null || lookup === void 0 ? void 0 : lookup.definitionId) instanceof types_1.MethodDefinition) {
49
- return { range, placeholder: cursor.token.getStr(), type: RenameType.Method, file };
54
+ return { range, placeholder, type: RenameType.Method, file };
50
55
  }
51
56
  return undefined;
52
57
  }
@@ -127,6 +127,6 @@ class SemanticHighlighting {
127
127
  return ret;
128
128
  }
129
129
  }
130
- SemanticHighlighting.tokenTypes = [];
131
130
  exports.SemanticHighlighting = SemanticHighlighting;
131
+ SemanticHighlighting.tokenTypes = [];
132
132
  //# sourceMappingURL=semantic.js.map
@@ -9,7 +9,7 @@ var ClassCategory;
9
9
  ClassCategory["PersistentFactory"] = "11";
10
10
  ClassCategory["Exception"] = "40";
11
11
  ClassCategory["SharedObject"] = "45";
12
- })(ClassCategory = exports.ClassCategory || (exports.ClassCategory = {}));
12
+ })(ClassCategory || (exports.ClassCategory = ClassCategory = {}));
13
13
  class Class extends _abap_object_1.ABAPObject {
14
14
  constructor() {
15
15
  super(...arguments);
@@ -15,7 +15,7 @@ var EnhancementCategory;
15
15
  EnhancementCategory["Character"] = "2";
16
16
  EnhancementCategory["CharacterOrNumeric"] = "3";
17
17
  EnhancementCategory["Deep"] = "4";
18
- })(EnhancementCategory = exports.EnhancementCategory || (exports.EnhancementCategory = {}));
18
+ })(EnhancementCategory || (exports.EnhancementCategory = EnhancementCategory = {}));
19
19
  var TableCategory;
20
20
  (function (TableCategory) {
21
21
  TableCategory["Transparent"] = "TRANSP";
@@ -24,7 +24,7 @@ var TableCategory;
24
24
  TableCategory["Pooled"] = "POOL";
25
25
  TableCategory["View"] = "VIEW";
26
26
  TableCategory["Append"] = "APPEND";
27
- })(TableCategory = exports.TableCategory || (exports.TableCategory = {}));
27
+ })(TableCategory || (exports.TableCategory = TableCategory = {}));
28
28
  class Table extends _abstract_object_1.AbstractObject {
29
29
  getType() {
30
30
  return "TABL";
@@ -65,7 +65,7 @@ class Registry {
65
65
  }
66
66
  static abaplintVersion() {
67
67
  // magic, see build script "version.sh"
68
- return "2.101.9";
68
+ return "2.101.10";
69
69
  }
70
70
  getDDICReferences() {
71
71
  return this.ddicReferences;
@@ -17,5 +17,5 @@ var RuleTag;
17
17
  RuleTag["Styleguide"] = "Styleguide";
18
18
  /** Single file compatible, the rule gives correct results when having only information about the single file */
19
19
  RuleTag["SingleFile"] = "SingleFile";
20
- })(RuleTag = exports.RuleTag || (exports.RuleTag = {}));
20
+ })(RuleTag || (exports.RuleTag = RuleTag = {}));
21
21
  //# sourceMappingURL=_irule.js.map
@@ -2672,9 +2672,16 @@ ${indentation} output = ${topTarget}.`;
2672
2672
  const data = `DATA ${name} TYPE REF TO ${type}.\n` +
2673
2673
  indentation + abap + "\n" +
2674
2674
  indentation;
2675
- const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), data);
2676
- const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, found.getFirstToken().getStart(), found.getLastToken().getEnd(), name);
2677
- fix = edit_helper_1.EditHelper.merge(fix2, fix1);
2675
+ if (found.getFirstToken().getStart().equals(high.getFirstToken().getStart())
2676
+ && found.getLastToken().getEnd().equals(high.getLastToken().getStart())) {
2677
+ // full statement = standalone NEW expression
2678
+ fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), abap);
2679
+ }
2680
+ else {
2681
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), data);
2682
+ const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, found.getFirstToken().getStart(), found.getLastToken().getEnd(), name);
2683
+ fix = edit_helper_1.EditHelper.merge(fix2, fix1);
2684
+ }
2678
2685
  }
2679
2686
  if (fix) {
2680
2687
  return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Use CREATE OBJECT instead of NEW", this.getMetadata().key, this.conf.severity, fix);
@@ -62,24 +62,24 @@ class EmptyStructure extends _abap_rule_1.ABAPRule {
62
62
  }
63
63
  const candidates = [];
64
64
  if (this.getConfig().loop === true) {
65
- candidates.push(...stru.findAllStructures(Structures.Loop));
65
+ candidates.push(...stru.findAllStructuresRecursive(Structures.Loop));
66
66
  }
67
67
  if (this.getConfig().while === true) {
68
- candidates.push(...stru.findAllStructures(Structures.While));
68
+ candidates.push(...stru.findAllStructuresRecursive(Structures.While));
69
69
  }
70
70
  if (this.getConfig().case === true) {
71
- candidates.push(...stru.findAllStructures(Structures.Case));
71
+ candidates.push(...stru.findAllStructuresRecursive(Structures.Case));
72
72
  }
73
73
  if (this.getConfig().select === true) {
74
- candidates.push(...stru.findAllStructures(Structures.Select));
74
+ candidates.push(...stru.findAllStructuresRecursive(Structures.Select));
75
75
  }
76
76
  if (this.getConfig().do === true) {
77
- candidates.push(...stru.findAllStructures(Structures.Do));
77
+ candidates.push(...stru.findAllStructuresRecursive(Structures.Do));
78
78
  }
79
79
  if (this.getConfig().at === true) {
80
- candidates.push(...stru.findAllStructures(Structures.At));
81
- candidates.push(...stru.findAllStructures(Structures.AtFirst));
82
- candidates.push(...stru.findAllStructures(Structures.AtLast));
80
+ candidates.push(...stru.findAllStructuresRecursive(Structures.At));
81
+ candidates.push(...stru.findAllStructuresRecursive(Structures.AtFirst));
82
+ candidates.push(...stru.findAllStructuresRecursive(Structures.AtLast));
83
83
  }
84
84
  for (const l of candidates) {
85
85
  if (l.getChildren().length === 2) {
@@ -89,7 +89,7 @@ class EmptyStructure extends _abap_rule_1.ABAPRule {
89
89
  }
90
90
  }
91
91
  if (this.getConfig().try === true) {
92
- const tries = stru.findAllStructures(Structures.Try);
92
+ const tries = stru.findAllStructuresRecursive(Structures.Try);
93
93
  for (const t of tries) {
94
94
  const normal = t.findDirectStructure(Structures.Body);
95
95
  if (normal === undefined) {
@@ -100,9 +100,9 @@ class EmptyStructure extends _abap_rule_1.ABAPRule {
100
100
  }
101
101
  }
102
102
  if (this.getConfig().if === true) {
103
- const tries = stru.findAllStructures(Structures.If)
104
- .concat(stru.findAllStructures(Structures.Else))
105
- .concat(stru.findAllStructures(Structures.ElseIf));
103
+ const tries = stru.findAllStructuresRecursive(Structures.If)
104
+ .concat(stru.findAllStructuresRecursive(Structures.Else))
105
+ .concat(stru.findAllStructuresRecursive(Structures.ElseIf));
106
106
  for (const t of tries) {
107
107
  const normal = t.findDirectStructure(Structures.Body);
108
108
  if (normal === undefined) {
@@ -113,7 +113,7 @@ class EmptyStructure extends _abap_rule_1.ABAPRule {
113
113
  }
114
114
  }
115
115
  if (this.getConfig().when === true) {
116
- const tries = stru.findAllStructures(Structures.When);
116
+ const tries = stru.findAllStructuresRecursive(Structures.When);
117
117
  for (const t of tries) {
118
118
  if (t.getChildren().length === 1) {
119
119
  const token = t.getFirstToken();
@@ -18,7 +18,7 @@ var KeywordCaseStyle;
18
18
  (function (KeywordCaseStyle) {
19
19
  KeywordCaseStyle["Upper"] = "upper";
20
20
  KeywordCaseStyle["Lower"] = "lower";
21
- })(KeywordCaseStyle = exports.KeywordCaseStyle || (exports.KeywordCaseStyle = {}));
21
+ })(KeywordCaseStyle || (exports.KeywordCaseStyle = KeywordCaseStyle = {}));
22
22
  class KeywordCaseConf extends _basic_rule_config_1.BasicRuleConfig {
23
23
  constructor() {
24
24
  super(...arguments);
@@ -11,7 +11,7 @@ var NewlineLogic;
11
11
  (function (NewlineLogic) {
12
12
  NewlineLogic["Exact"] = "exact";
13
13
  NewlineLogic["Less"] = "less";
14
- })(NewlineLogic = exports.NewlineLogic || (exports.NewlineLogic = {}));
14
+ })(NewlineLogic || (exports.NewlineLogic = NewlineLogic = {}));
15
15
  class NewlineBetweenMethodsConf extends _basic_rule_config_1.BasicRuleConfig {
16
16
  constructor() {
17
17
  super(...arguments);
@@ -6,5 +6,5 @@ var Severity;
6
6
  Severity["Error"] = "Error";
7
7
  Severity["Warning"] = "Warning";
8
8
  Severity["Info"] = "Info";
9
- })(Severity = exports.Severity || (exports.Severity = {}));
9
+ })(Severity || (exports.Severity = Severity = {}));
10
10
  //# sourceMappingURL=severity.js.map
@@ -18,7 +18,7 @@ var Version;
18
18
  Version["v756"] = "v756";
19
19
  Version["v757"] = "v757";
20
20
  Version["Cloud"] = "Cloud";
21
- })(Version = exports.Version || (exports.Version = {}));
21
+ })(Version || (exports.Version = Version = {}));
22
22
  exports.defaultVersion = Version.v757;
23
23
  function getPreviousVersion(v) {
24
24
  if (v === Version.OpenABAP) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.101.9",
3
+ "version": "2.101.10",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -58,7 +58,7 @@
58
58
  "c8": "^7.14.0",
59
59
  "source-map-support": "^0.5.21",
60
60
  "ts-json-schema-generator": "^1.2.0",
61
- "typescript": "^5.0.4"
61
+ "typescript": "^5.1.3"
62
62
  },
63
63
  "dependencies": {
64
64
  "fast-xml-parser": "^4.2.2",