@abaplint/core 2.112.0 → 2.112.1
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/src/abap/5_syntax/expressions/attribute_chain.js +1 -1
- package/build/src/abap/5_syntax/expressions/cast.js +1 -1
- package/build/src/abap/5_syntax/expressions/component_chain.js +7 -7
- package/build/src/abap/5_syntax/expressions/method_call_chain.js +2 -2
- package/build/src/abap/5_syntax/structures/data.js +1 -1
- package/build/src/abap/types/interface_definition.js +5 -4
- package/build/src/registry.js +1 -1
- package/build/src/rules/double_space.js +6 -3
- package/package.json +1 -1
|
@@ -36,7 +36,7 @@ class AttributeChain {
|
|
|
36
36
|
}
|
|
37
37
|
if (context === undefined) {
|
|
38
38
|
const message = "Attribute or constant \"" + name + "\" not found in \"" + def.getName() + "\"";
|
|
39
|
-
input.issues.push((0, _syntax_input_1.syntaxIssue)(input,
|
|
39
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, nameToken, message));
|
|
40
40
|
return new void_type_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
41
41
|
}
|
|
42
42
|
for (const t of type) {
|
|
@@ -55,7 +55,7 @@ class Cast {
|
|
|
55
55
|
else if (tt === undefined) {
|
|
56
56
|
// todo, this should be an UnknownType instead?
|
|
57
57
|
const message = "Type \"" + typeName + "\" not found in scope, Cast";
|
|
58
|
-
input.issues.push((0, _syntax_input_1.syntaxIssue)(input,
|
|
58
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, typeExpression.getFirstToken(), message));
|
|
59
59
|
return new basic_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -28,21 +28,21 @@ class ComponentChain {
|
|
|
28
28
|
if (concat === "-") {
|
|
29
29
|
if (!(context instanceof structure_type_1.StructureType)) {
|
|
30
30
|
const message = "ComponentChain, not a structure";
|
|
31
|
-
input.issues.push((0, _syntax_input_1.syntaxIssue)(input,
|
|
31
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, child.getFirstToken(), message));
|
|
32
32
|
return new void_type_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
else if (concat === "=>") {
|
|
36
36
|
if (!(context instanceof basic_1.ObjectReferenceType)) {
|
|
37
37
|
const message = "ComponentChain, not a reference";
|
|
38
|
-
input.issues.push((0, _syntax_input_1.syntaxIssue)(input,
|
|
38
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, child.getFirstToken(), message));
|
|
39
39
|
return new void_type_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
else if (concat === "->") {
|
|
43
43
|
if (!(context instanceof basic_1.ObjectReferenceType) && !(context instanceof basic_1.DataReference)) {
|
|
44
44
|
const message = "ComponentChain, not a reference";
|
|
45
|
-
input.issues.push((0, _syntax_input_1.syntaxIssue)(input,
|
|
45
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, child.getFirstToken(), message));
|
|
46
46
|
return new void_type_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -59,7 +59,7 @@ class ComponentChain {
|
|
|
59
59
|
context = context.getComponentByName(name);
|
|
60
60
|
if (context === undefined) {
|
|
61
61
|
const message = "Component \"" + name + "\" not found in structure";
|
|
62
|
-
input.issues.push((0, _syntax_input_1.syntaxIssue)(input,
|
|
62
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, child.getFirstToken(), message));
|
|
63
63
|
return new void_type_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -68,7 +68,7 @@ class ComponentChain {
|
|
|
68
68
|
const def = input.scope.findObjectDefinition(id.getName());
|
|
69
69
|
if (def === undefined) {
|
|
70
70
|
const message = id.getName() + " not found in scope";
|
|
71
|
-
input.issues.push((0, _syntax_input_1.syntaxIssue)(input,
|
|
71
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, child.getFirstToken(), message));
|
|
72
72
|
return new void_type_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
73
73
|
}
|
|
74
74
|
const helper = new _object_oriented_1.ObjectOriented(input.scope);
|
|
@@ -76,7 +76,7 @@ class ComponentChain {
|
|
|
76
76
|
context = found === null || found === void 0 ? void 0 : found.getType();
|
|
77
77
|
if (context === undefined) {
|
|
78
78
|
const message = "Attribute \"" + name + "\" not found";
|
|
79
|
-
input.issues.push((0, _syntax_input_1.syntaxIssue)(input,
|
|
79
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, child.getFirstToken(), message));
|
|
80
80
|
return new void_type_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
81
81
|
}
|
|
82
82
|
else {
|
|
@@ -89,7 +89,7 @@ class ComponentChain {
|
|
|
89
89
|
}
|
|
90
90
|
else {
|
|
91
91
|
const message = "ComponentChain, not a structure, " + (context === null || context === void 0 ? void 0 : context.constructor.name);
|
|
92
|
-
input.issues.push((0, _syntax_input_1.syntaxIssue)(input,
|
|
92
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, child.getFirstToken(), message));
|
|
93
93
|
return new void_type_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -53,7 +53,7 @@ class MethodCallChain {
|
|
|
53
53
|
else {
|
|
54
54
|
if (previous && previous.getFirstToken().getStr() === "=>" && (method === null || method === void 0 ? void 0 : method.isStatic()) === false) {
|
|
55
55
|
const message = "Method \"" + methodName + "\" not static";
|
|
56
|
-
input.issues.push((0, _syntax_input_1.syntaxIssue)(input,
|
|
56
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, methodToken, message));
|
|
57
57
|
return new basic_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
58
58
|
}
|
|
59
59
|
const extra = {
|
|
@@ -74,7 +74,7 @@ class MethodCallChain {
|
|
|
74
74
|
}
|
|
75
75
|
else if (method === undefined && !(context instanceof basic_1.VoidType)) {
|
|
76
76
|
const message = "Method \"" + methodName + "\" not found, methodCallChain";
|
|
77
|
-
input.issues.push((0, _syntax_input_1.syntaxIssue)(input,
|
|
77
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, methodToken, message));
|
|
78
78
|
return new basic_1.VoidType(_syntax_input_1.CheckSyntaxKey);
|
|
79
79
|
}
|
|
80
80
|
else if (method) {
|
|
@@ -74,7 +74,7 @@ class Data {
|
|
|
74
74
|
}
|
|
75
75
|
if (!(found instanceof Basic.StructureType)) {
|
|
76
76
|
const message = "not structured, " + typeName;
|
|
77
|
-
input.issues.push((0, _syntax_input_1.syntaxIssue)(input,
|
|
77
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, typeToken, message));
|
|
78
78
|
return new _typed_identifier_1.TypedIdentifier(name, input.filename, new Basic.VoidType(_syntax_input_1.CheckSyntaxKey));
|
|
79
79
|
}
|
|
80
80
|
for (const c of found.getComponents()) {
|
|
@@ -65,6 +65,7 @@ class InterfaceDefinition extends _identifier_1.Identifier {
|
|
|
65
65
|
this.typeDefinitions = this.attributes.getTypes();
|
|
66
66
|
this.aliases = new aliases_1.Aliases(node, this.filename, input.scope);
|
|
67
67
|
// todo, cleanup aliases, vs "object_oriented.ts" vs "class_implementation.ts"
|
|
68
|
+
// this adds the aliased types to scope?
|
|
68
69
|
for (const a of this.aliases.getAll()) {
|
|
69
70
|
const [objName, fieldName] = a.getComponent().split("~");
|
|
70
71
|
const idef = input.scope.findInterfaceDefinition(objName);
|
|
@@ -84,10 +85,6 @@ class InterfaceDefinition extends _identifier_1.Identifier {
|
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
|
-
this.methodDefinitions = new method_definitions_1.MethodDefinitions(node, input);
|
|
88
|
-
if (this.methodDefinitions.getByName("CONSTRUCTOR") !== undefined) {
|
|
89
|
-
throw new Error("Interfaces cannot have constructor methods");
|
|
90
|
-
}
|
|
91
88
|
const events = node.findAllStatements(Statements.Events);
|
|
92
89
|
for (const e of events) {
|
|
93
90
|
this.events.push(new event_definition_1.EventDefinition(e, visibility_1.Visibility.Public, input));
|
|
@@ -109,6 +106,10 @@ class InterfaceDefinition extends _identifier_1.Identifier {
|
|
|
109
106
|
}
|
|
110
107
|
}
|
|
111
108
|
}
|
|
109
|
+
this.methodDefinitions = new method_definitions_1.MethodDefinitions(node, input);
|
|
110
|
+
if (this.methodDefinitions.getByName("CONSTRUCTOR") !== undefined) {
|
|
111
|
+
throw new Error("Interfaces cannot have constructor methods");
|
|
112
|
+
}
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
115
|
exports.InterfaceDefinition = InterfaceDefinition;
|
package/build/src/registry.js
CHANGED
|
@@ -16,6 +16,8 @@ class DoubleSpaceConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
|
16
16
|
super(...arguments);
|
|
17
17
|
/** Check for double space after keywords */
|
|
18
18
|
this.keywords = true;
|
|
19
|
+
/** list of keywords to skip, case insensitive */
|
|
20
|
+
this.skipKeywords = ["CHANGING", "EXPORTING", "OTHERS"];
|
|
19
21
|
/** Check for double space after start parenthesis */
|
|
20
22
|
this.startParen = true;
|
|
21
23
|
/** Check for double space before end parenthesis */
|
|
@@ -48,6 +50,9 @@ class DoubleSpace extends _abap_rule_1.ABAPRule {
|
|
|
48
50
|
}
|
|
49
51
|
setConfig(conf) {
|
|
50
52
|
this.conf = conf;
|
|
53
|
+
if (this.conf.skipKeywords === undefined) {
|
|
54
|
+
this.conf.skipKeywords = new DoubleSpaceConf().skipKeywords;
|
|
55
|
+
}
|
|
51
56
|
}
|
|
52
57
|
runParsed(file) {
|
|
53
58
|
let issues = [];
|
|
@@ -159,9 +164,7 @@ class DoubleSpace extends _abap_rule_1.ABAPRule {
|
|
|
159
164
|
if (prev instanceof nodes_1.TokenNodeRegex
|
|
160
165
|
|| upper === "("
|
|
161
166
|
|| upper === ")"
|
|
162
|
-
||
|
|
163
|
-
|| upper === "EXPORTING"
|
|
164
|
-
|| upper === "OTHERS") {
|
|
167
|
+
|| this.getConfig().skipKeywords.some(e => e.toUpperCase() === upper)) {
|
|
165
168
|
// not a keyword, continue
|
|
166
169
|
prev = n;
|
|
167
170
|
continue;
|