@abaplint/core 2.89.5 → 2.89.6
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/abaplint.d.ts
CHANGED
|
@@ -1144,7 +1144,7 @@ export declare class CurrentScope {
|
|
|
1144
1144
|
/** Lookup class in local and global scope */
|
|
1145
1145
|
findClassDefinition(name: string | undefined): IClassDefinition | undefined;
|
|
1146
1146
|
findTypePoolConstant(name: string | undefined): TypedIdentifier | undefined;
|
|
1147
|
-
findTypePoolType(name: string):
|
|
1147
|
+
findTypePoolType(name: string): TypedIdentifier | undefined;
|
|
1148
1148
|
/** Lookup interface in local and global scope */
|
|
1149
1149
|
findInterfaceDefinition(name: string): IInterfaceDefinition | undefined;
|
|
1150
1150
|
findFormDefinition(name: string): IFormDefinition | undefined;
|
|
@@ -220,7 +220,7 @@ class CurrentScope {
|
|
|
220
220
|
return found;
|
|
221
221
|
}
|
|
222
222
|
findTypePoolType(name) {
|
|
223
|
-
var _a
|
|
223
|
+
var _a;
|
|
224
224
|
if (name.includes("_") === undefined) {
|
|
225
225
|
return undefined;
|
|
226
226
|
}
|
|
@@ -230,7 +230,7 @@ class CurrentScope {
|
|
|
230
230
|
return undefined;
|
|
231
231
|
}
|
|
232
232
|
const spag = (_a = new syntax_1.SyntaxLogic(this.reg, typePool).run().spaghetti.getFirstChild()) === null || _a === void 0 ? void 0 : _a.getFirstChild();
|
|
233
|
-
const found =
|
|
233
|
+
const found = spag === null || spag === void 0 ? void 0 : spag.findType(name);
|
|
234
234
|
return found;
|
|
235
235
|
}
|
|
236
236
|
/** Lookup interface in local and global scope */
|
|
@@ -52,6 +52,10 @@ class BasicTypes {
|
|
|
52
52
|
if (builtin) {
|
|
53
53
|
return new _typed_identifier_1.TypedIdentifier(new identifier_1.Identifier(new position_1.Position(1, 1), name), _builtin_1.BuiltIn.filename, builtin);
|
|
54
54
|
}
|
|
55
|
+
const type = this.scope.findTypePoolType(name);
|
|
56
|
+
if (type) {
|
|
57
|
+
return type;
|
|
58
|
+
}
|
|
55
59
|
return undefined;
|
|
56
60
|
}
|
|
57
61
|
resolveLikeName(node, headerLogic = true) {
|
|
@@ -145,6 +149,7 @@ class BasicTypes {
|
|
|
145
149
|
return type;
|
|
146
150
|
}
|
|
147
151
|
resolveTypeName(typeName, length, decimals, name) {
|
|
152
|
+
var _a;
|
|
148
153
|
if (typeName === undefined) {
|
|
149
154
|
return undefined;
|
|
150
155
|
}
|
|
@@ -170,7 +175,7 @@ class BasicTypes {
|
|
|
170
175
|
this.scope.addReference(token, typ, _reference_1.ReferenceType.TypeReference, this.filename);
|
|
171
176
|
return typ.getType();
|
|
172
177
|
}
|
|
173
|
-
const type = this.scope.findTypePoolType(chainText);
|
|
178
|
+
const type = (_a = this.scope.findTypePoolType(chainText)) === null || _a === void 0 ? void 0 : _a.getType();
|
|
174
179
|
if (type) {
|
|
175
180
|
// this.scope.addReference(typeName.getFirstToken(), type, ReferenceType.TypeReference, this.filename);
|
|
176
181
|
return type;
|
|
@@ -445,6 +450,7 @@ class BasicTypes {
|
|
|
445
450
|
/////////////////////
|
|
446
451
|
// todo, rewrite this method
|
|
447
452
|
resolveTypeChain(expr) {
|
|
453
|
+
var _a;
|
|
448
454
|
const chainText = expr.concatTokens().toUpperCase();
|
|
449
455
|
if (chainText.includes("=>") === false && chainText.includes("-") === false) {
|
|
450
456
|
return undefined;
|
|
@@ -496,7 +502,7 @@ class BasicTypes {
|
|
|
496
502
|
const found = this.scope.findType(subs[0]);
|
|
497
503
|
foundType = found === null || found === void 0 ? void 0 : found.getType();
|
|
498
504
|
if (foundType === undefined) {
|
|
499
|
-
const typePoolType = this.scope.findTypePoolType(subs[0]);
|
|
505
|
+
const typePoolType = (_a = this.scope.findTypePoolType(subs[0])) === null || _a === void 0 ? void 0 : _a.getType();
|
|
500
506
|
if (typePoolType) {
|
|
501
507
|
// this.scope.addReference(typeName.getFirstToken(), typePoolType, ReferenceType.TypeReference, this.filename);
|
|
502
508
|
foundType = typePoolType;
|
package/build/src/registry.js
CHANGED
|
@@ -42,6 +42,7 @@ class DefinitionsTop extends _abap_rule_1.ABAPRule {
|
|
|
42
42
|
this.conf = conf;
|
|
43
43
|
}
|
|
44
44
|
runParsed(file) {
|
|
45
|
+
var _a;
|
|
45
46
|
const issues = [];
|
|
46
47
|
const structure = file.getStructure();
|
|
47
48
|
if (structure === undefined) {
|
|
@@ -52,7 +53,7 @@ class DefinitionsTop extends _abap_rule_1.ABAPRule {
|
|
|
52
53
|
// one fix per routine
|
|
53
54
|
this.fixed = false;
|
|
54
55
|
this.mode = DEFINITION;
|
|
55
|
-
this.moveTo = r.getFirstStatement();
|
|
56
|
+
this.moveTo = (_a = r.getFirstStatement()) === null || _a === void 0 ? void 0 : _a.getLastToken().getEnd();
|
|
56
57
|
const found = this.walk(r, file);
|
|
57
58
|
if (found) {
|
|
58
59
|
issues.push(found);
|
|
@@ -81,6 +82,9 @@ class DefinitionsTop extends _abap_rule_1.ABAPRule {
|
|
|
81
82
|
// no quick fixes for these, its difficult?
|
|
82
83
|
return issue_1.Issue.atStatement(file, c.getFirstStatement(), this.getMessage(), this.getMetadata().key, this.conf.severity);
|
|
83
84
|
}
|
|
85
|
+
else {
|
|
86
|
+
this.moveTo = c.getLastToken().getEnd();
|
|
87
|
+
}
|
|
84
88
|
}
|
|
85
89
|
else if (c instanceof nodes_1.StatementNode
|
|
86
90
|
&& (c.get() instanceof Statements.Data
|
|
@@ -98,7 +102,7 @@ class DefinitionsTop extends _abap_rule_1.ABAPRule {
|
|
|
98
102
|
return issue_1.Issue.atStatement(file, c, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);
|
|
99
103
|
}
|
|
100
104
|
else {
|
|
101
|
-
this.moveTo = c;
|
|
105
|
+
this.moveTo = c.getLastToken().getEnd();
|
|
102
106
|
}
|
|
103
107
|
}
|
|
104
108
|
else if (c instanceof nodes_1.StructureNode && c.get() instanceof Structures.Define) {
|
|
@@ -121,12 +125,12 @@ class DefinitionsTop extends _abap_rule_1.ABAPRule {
|
|
|
121
125
|
}
|
|
122
126
|
return undefined;
|
|
123
127
|
}
|
|
124
|
-
buildFix(file, statement,
|
|
128
|
+
buildFix(file, statement, at) {
|
|
125
129
|
let concat = statement.concatTokens();
|
|
126
130
|
concat = concat.replace(/,$/, ".");
|
|
127
131
|
const fix1 = edit_helper_1.EditHelper.deleteStatement(file, statement);
|
|
128
132
|
const indentation = " ".repeat(statement.getFirstToken().getCol() - 1);
|
|
129
|
-
const fix2 = edit_helper_1.EditHelper.insertAt(file,
|
|
133
|
+
const fix2 = edit_helper_1.EditHelper.insertAt(file, at, "\n" + indentation + concat);
|
|
130
134
|
return edit_helper_1.EditHelper.merge(fix1, fix2);
|
|
131
135
|
}
|
|
132
136
|
}
|