@abaplint/core 2.89.0 → 2.89.3
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/basic_types.js +1 -1
- package/build/src/abap/5_syntax/expressions/cast.js +2 -0
- package/build/src/abap/5_syntax/expressions/source.js +18 -3
- package/build/src/abap/5_syntax/statements/find.js +2 -2
- package/build/src/registry.js +1 -1
- package/build/src/rules/downport.js +4 -1
- package/build/src/rules/no_inline_in_optional_branches.js +8 -1
- package/build/src/rules/unknown_types.js +7 -0
- package/package.json +3 -3
|
@@ -623,7 +623,7 @@ class BasicTypes {
|
|
|
623
623
|
const search = this.scope.existsObject(name);
|
|
624
624
|
if (search.found === true && search.id) {
|
|
625
625
|
this.scope.addReference(chain.getFirstToken(), search.id, _reference_1.ReferenceType.ObjectOrientedReference, this.filename, { ooType: search.ooType, ooName: name });
|
|
626
|
-
return new Types.ObjectReferenceType(search.id);
|
|
626
|
+
return new Types.ObjectReferenceType(search.id, name);
|
|
627
627
|
}
|
|
628
628
|
}
|
|
629
629
|
const found = this.resolveTypeName(chain);
|
|
@@ -30,12 +30,14 @@ class Cast {
|
|
|
30
30
|
tt = new basic_1.VoidType(typeName);
|
|
31
31
|
}
|
|
32
32
|
else if (found === undefined) {
|
|
33
|
+
// todo, this should be an UnknownType instead?
|
|
33
34
|
throw new Error("Type \"" + typeName + "\" not found in scope, Cast");
|
|
34
35
|
}
|
|
35
36
|
else {
|
|
36
37
|
tt = new basic_1.ObjectReferenceType(found);
|
|
37
38
|
}
|
|
38
39
|
}
|
|
40
|
+
new source_1.Source().addIfInferred(node, scope, filename, tt);
|
|
39
41
|
if (new _type_utils_1.TypeUtils(scope).isCastable(sourceType, tt) === false) {
|
|
40
42
|
throw new Error("Cast, incompatible types");
|
|
41
43
|
}
|
|
@@ -176,6 +176,13 @@ class Source {
|
|
|
176
176
|
if (found) {
|
|
177
177
|
scope.addReference(typeToken, found, _reference_1.ReferenceType.InferredType, filename);
|
|
178
178
|
}
|
|
179
|
+
else if (inferredType instanceof basic_1.ObjectReferenceType) {
|
|
180
|
+
const def = scope.findObjectDefinition(inferredType.getQualifiedName());
|
|
181
|
+
if (def) {
|
|
182
|
+
const tid = new _typed_identifier_1.TypedIdentifier(typeToken, filename, inferredType);
|
|
183
|
+
scope.addReference(typeToken, tid, _reference_1.ReferenceType.InferredType, filename);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
179
186
|
else if (inferredType instanceof basic_1.CharacterType) {
|
|
180
187
|
// character is bit special it does not have a qualified name eg "TYPE c LENGTH 6"
|
|
181
188
|
const tid = new _typed_identifier_1.TypedIdentifier(typeToken, filename, inferredType);
|
|
@@ -198,10 +205,18 @@ class Source {
|
|
|
198
205
|
}
|
|
199
206
|
return targetType;
|
|
200
207
|
}
|
|
201
|
-
if (typeName !== "#") {
|
|
208
|
+
if (typeName !== "#" && typeToken) {
|
|
202
209
|
const found = basic.parseType(typeExpression);
|
|
203
|
-
if (found
|
|
204
|
-
|
|
210
|
+
if (found && found instanceof unknown_type_1.UnknownType) {
|
|
211
|
+
if (scope.getDDIC().inErrorNamespace(typeName) === false) {
|
|
212
|
+
scope.addReference(typeToken, undefined, _reference_1.ReferenceType.VoidType, filename);
|
|
213
|
+
return new basic_1.VoidType(typeName);
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
const tid = new _typed_identifier_1.TypedIdentifier(typeToken, filename, found);
|
|
217
|
+
scope.addReference(typeToken, tid, _reference_1.ReferenceType.TypeReference, filename);
|
|
218
|
+
return found;
|
|
219
|
+
}
|
|
205
220
|
}
|
|
206
221
|
else if (found === undefined) {
|
|
207
222
|
throw new Error("Type \"" + typeName + "\" not found in scope, VALUE");
|
|
@@ -18,12 +18,12 @@ class Find {
|
|
|
18
18
|
{ name: "OFFSET", type: new basic_1.IntegerType() },
|
|
19
19
|
{ name: "LENGTH", type: new basic_1.IntegerType() },
|
|
20
20
|
{ name: "SUBMATCHES", type: new basic_1.TableType(new basic_1.StringType(), { withHeader: false }) },
|
|
21
|
-
]);
|
|
21
|
+
], "MATCH_RESULT");
|
|
22
22
|
if (node.concatTokens().toUpperCase().startsWith("FIND FIRST")) {
|
|
23
23
|
this.inline(rfound, scope, filename, type);
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
26
|
-
this.inline(rfound, scope, filename, new basic_1.TableType(type, { withHeader: false }));
|
|
26
|
+
this.inline(rfound, scope, filename, new basic_1.TableType(type, { withHeader: false }, "MATCH_RESULT_TAB"));
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
const ofound = node.findExpressionsAfterToken("OFFSET");
|
package/build/src/registry.js
CHANGED
|
@@ -1310,7 +1310,10 @@ ${indentation} output = ${topTarget}.`;
|
|
|
1310
1310
|
else if (found.getType() instanceof basic_1.VoidType && found.getType().getQualifiedName() === undefined) {
|
|
1311
1311
|
continue;
|
|
1312
1312
|
}
|
|
1313
|
-
|
|
1313
|
+
let type = found.getType().getQualifiedName() ? (_b = found.getType().getQualifiedName()) === null || _b === void 0 ? void 0 : _b.toLowerCase() : found.getType().toABAP();
|
|
1314
|
+
if (found.getType() instanceof basic_1.ObjectReferenceType) {
|
|
1315
|
+
type = found.getType().toABAP();
|
|
1316
|
+
}
|
|
1314
1317
|
const code = `DATA ${name} TYPE ${type}.\n` +
|
|
1315
1318
|
" ".repeat(node.getFirstToken().getStart().getCol() - 1);
|
|
1316
1319
|
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);
|
|
@@ -7,6 +7,7 @@ const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
|
7
7
|
const Structures = require("../abap/3_structures/structures");
|
|
8
8
|
const Expressions = require("../abap/2_statements/expressions");
|
|
9
9
|
const _irule_1 = require("./_irule");
|
|
10
|
+
const version_1 = require("../version");
|
|
10
11
|
class NoInlineInOptionalBranchesConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
11
12
|
}
|
|
12
13
|
exports.NoInlineInOptionalBranchesConf = NoInlineInOptionalBranchesConf;
|
|
@@ -43,6 +44,12 @@ Not considered optional branches:
|
|
|
43
44
|
}
|
|
44
45
|
runParsed(file) {
|
|
45
46
|
const output = [];
|
|
47
|
+
const version = this.reg.getConfig().getVersion();
|
|
48
|
+
if (version === version_1.Version.v700
|
|
49
|
+
|| version === version_1.Version.v702
|
|
50
|
+
|| version === version_1.Version.OpenABAP) {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
46
53
|
const struc = file.getStructure();
|
|
47
54
|
if (struc === undefined) {
|
|
48
55
|
return []; // syntax error
|
|
@@ -60,7 +67,7 @@ Not considered optional branches:
|
|
|
60
67
|
const inline = c.findFirstExpression(Expressions.InlineData);
|
|
61
68
|
if (inline) {
|
|
62
69
|
const message = "Don't declare inline in optional branches";
|
|
63
|
-
const issue = issue_1.Issue.atToken(file,
|
|
70
|
+
const issue = issue_1.Issue.atToken(file, inline.getFirstToken(), message, this.getMetadata().key, this.getConfig().severity);
|
|
64
71
|
output.push(issue);
|
|
65
72
|
}
|
|
66
73
|
}
|
|
@@ -10,6 +10,7 @@ const _irule_1 = require("./_irule");
|
|
|
10
10
|
const _typed_identifier_1 = require("../abap/types/_typed_identifier");
|
|
11
11
|
const _scope_type_1 = require("../abap/5_syntax/_scope_type");
|
|
12
12
|
const _reference_1 = require("../abap/5_syntax/_reference");
|
|
13
|
+
const basic_1 = require("../abap/types/basic");
|
|
13
14
|
class UnknownTypesConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
14
15
|
}
|
|
15
16
|
exports.UnknownTypesConf = UnknownTypesConf;
|
|
@@ -70,6 +71,12 @@ class UnknownTypes {
|
|
|
70
71
|
const message = r.extra.ooName + " unknown";
|
|
71
72
|
ret.push(issue_1.Issue.atIdentifier(r.position, message, this.getMetadata().key, this.conf.severity));
|
|
72
73
|
}
|
|
74
|
+
if (r.referenceType === _reference_1.ReferenceType.TypeReference
|
|
75
|
+
&& r.resolved instanceof _typed_identifier_1.TypedIdentifier
|
|
76
|
+
&& r.resolved.getType() instanceof basic_1.UnknownType) {
|
|
77
|
+
const message = r.resolved.getType().getError();
|
|
78
|
+
ret.push(issue_1.Issue.atIdentifier(r.position, message, this.getMetadata().key, this.conf.severity));
|
|
79
|
+
}
|
|
73
80
|
}
|
|
74
81
|
if (node.getIdentifier().stype !== _scope_type_1.ScopeType.ClassImplementation) {
|
|
75
82
|
const vars = nodeData.vars;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.89.
|
|
3
|
+
"version": "2.89.3",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
"@microsoft/api-extractor": "^7.22.2",
|
|
49
49
|
"@types/chai": "^4.3.1",
|
|
50
50
|
"@types/mocha": "^9.1.0",
|
|
51
|
-
"@types/node": "^17.0.
|
|
51
|
+
"@types/node": "^17.0.25",
|
|
52
52
|
"chai": "^4.3.6",
|
|
53
53
|
"eslint": "^8.13.0",
|
|
54
54
|
"mocha": "^9.2.2",
|
|
55
|
-
"c8": "^7.11.
|
|
55
|
+
"c8": "^7.11.2",
|
|
56
56
|
"source-map-support": "^0.5.21",
|
|
57
57
|
"ts-json-schema-generator": "^1.0.0",
|
|
58
58
|
"typescript": "^4.6.3"
|