@abaplint/core 2.113.168 → 2.113.170
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 +3 -3
- package/build/src/abap/2_statements/expressions/new_object.js +1 -1
- package/build/src/abap/2_statements/expressions/source.js +1 -1
- package/build/src/abap/5_syntax/_builtin.js +3 -3
- package/build/src/abap/5_syntax/expressions/method_call_chain.js +1 -1
- package/build/src/abap/5_syntax/expressions/new_object.js +6 -1
- package/build/src/abap/5_syntax/expressions/source.js +4 -3
- package/build/src/lsp/_lookup.js +1 -1
- package/build/src/registry.js +1 -1
- package/build/src/rules/downport.js +10 -1
- package/build/src/rules/method_overwrites_builtin.js +1 -2
- package/package.json +1 -1
package/build/abaplint.d.ts
CHANGED
|
@@ -592,9 +592,9 @@ export declare class BuiltIn {
|
|
|
592
592
|
[name: string]: IBuiltinMethod;
|
|
593
593
|
};
|
|
594
594
|
private row;
|
|
595
|
-
private buildDefinition;
|
|
596
|
-
searchBuiltin(name: string | undefined): IMethodDefinition | undefined;
|
|
597
|
-
isPredicate(name: string | undefined): boolean | undefined;
|
|
595
|
+
private static buildDefinition;
|
|
596
|
+
static searchBuiltin(name: string | undefined): IMethodDefinition | undefined;
|
|
597
|
+
static isPredicate(name: string | undefined): boolean | undefined;
|
|
598
598
|
getTypes(): TypedIdentifier[];
|
|
599
599
|
get(extras: string[]): TypedIdentifier[];
|
|
600
600
|
private buildVariable;
|
|
@@ -12,7 +12,7 @@ class NewObject extends combi_1.Expression {
|
|
|
12
12
|
const lines = (0, combi_1.plus)((0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), _1.Source, (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
13
13
|
const linesFields = (0, combi_1.plus)((0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), (0, combi_1.plus)(field_assignment_1.FieldAssignment), (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
14
14
|
const neww = (0, combi_1.seq)("NEW", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), (0, combi_1.optPrio)((0, combi_1.alt)(_1.Source, _1.ParameterListS, lines, linesFields)), ")");
|
|
15
|
-
return (0, combi_1.ver)(version_1.Version.v740sp02, neww);
|
|
15
|
+
return (0, combi_1.ver)(version_1.Version.v740sp02, neww, version_1.Version.OpenABAP);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
exports.NewObject = NewObject;
|
|
@@ -22,7 +22,7 @@ class Source extends combi_1.Expression {
|
|
|
22
22
|
// paren used for eg. "( 2 + 1 ) * 4"
|
|
23
23
|
const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), Source, rparen);
|
|
24
24
|
const after = (0, combi_1.seq)((0, combi_1.altPrio)("&", "&&", _1.ArithOperator), Source);
|
|
25
|
-
const bool = (0, combi_1.seq)((0, combi_1.altPrio)((0, combi_1.ver)(version_1.Version.v702, (0, combi_1.regex)(/^BOOLC$/i)), (0, combi_1.ver)(version_1.Version.v740sp08, (0, combi_1.regex)(/^XSDBOOL$/i))), (0, combi_1.tok)(tokens_1.ParenLeftW), _1.Cond, ")");
|
|
25
|
+
const bool = (0, combi_1.seq)((0, combi_1.altPrio)((0, combi_1.ver)(version_1.Version.v702, (0, combi_1.regex)(/^BOOLC$/i), version_1.Version.OpenABAP), (0, combi_1.ver)(version_1.Version.v740sp08, (0, combi_1.regex)(/^XSDBOOL$/i)), version_1.Version.OpenABAP), (0, combi_1.tok)(tokens_1.ParenLeftW), _1.Cond, ")");
|
|
26
26
|
const prefix = (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WPlus), "BIT-NOT");
|
|
27
27
|
const old = (0, combi_1.seq)((0, combi_1.optPrio)(prefix), (0, combi_1.altPrio)(_1.Constant, _1.StringTemplate, text_element_1.TextElement, bool, method, (0, combi_1.seq)(_1.FieldChain, deref), paren), (0, combi_1.optPrio)(after));
|
|
28
28
|
const corr = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)("CORRESPONDING", _1.TypeNameOrInfer, (0, combi_1.tok)(tokens_1.ParenLeftW), _1.CorrespondingBody, rparen, (0, combi_1.optPrio)(after)));
|
|
@@ -99,7 +99,7 @@ class BuiltIn {
|
|
|
99
99
|
constructor() {
|
|
100
100
|
this.row = 1;
|
|
101
101
|
}
|
|
102
|
-
buildDefinition(method, name) {
|
|
102
|
+
static buildDefinition(method, name) {
|
|
103
103
|
if (method.cache) {
|
|
104
104
|
return method.cache;
|
|
105
105
|
}
|
|
@@ -108,7 +108,7 @@ class BuiltIn {
|
|
|
108
108
|
method.cache = result;
|
|
109
109
|
return result;
|
|
110
110
|
}
|
|
111
|
-
searchBuiltin(name) {
|
|
111
|
+
static searchBuiltin(name) {
|
|
112
112
|
if (name === undefined) {
|
|
113
113
|
return undefined;
|
|
114
114
|
}
|
|
@@ -118,7 +118,7 @@ class BuiltIn {
|
|
|
118
118
|
}
|
|
119
119
|
return this.buildDefinition(def, name);
|
|
120
120
|
}
|
|
121
|
-
isPredicate(name) {
|
|
121
|
+
static isPredicate(name) {
|
|
122
122
|
if (name === undefined) {
|
|
123
123
|
return undefined;
|
|
124
124
|
}
|
|
@@ -46,7 +46,7 @@ class MethodCallChain {
|
|
|
46
46
|
// eslint-disable-next-line prefer-const
|
|
47
47
|
let { method, def: foundDef } = helper.searchMethodName(def, methodName);
|
|
48
48
|
if (method === undefined && current === first) {
|
|
49
|
-
method =
|
|
49
|
+
method = _builtin_1.BuiltIn.searchBuiltin(methodName === null || methodName === void 0 ? void 0 : methodName.toUpperCase());
|
|
50
50
|
if (method) {
|
|
51
51
|
input.scope.addReference(methodToken, method, _reference_1.ReferenceType.BuiltinMethodReference, input.filename);
|
|
52
52
|
}
|
|
@@ -11,11 +11,15 @@ const basic_types_1 = require("../basic_types");
|
|
|
11
11
|
const _type_utils_1 = require("../_type_utils");
|
|
12
12
|
const _syntax_input_1 = require("../_syntax_input");
|
|
13
13
|
const assert_error_1 = require("../assert_error");
|
|
14
|
+
const _typed_identifier_1 = require("../../types/_typed_identifier");
|
|
14
15
|
class NewObject {
|
|
15
16
|
static runSyntax(node, input, targetType) {
|
|
16
17
|
let ret = undefined;
|
|
17
18
|
const typeExpr = node.findDirectExpression(Expressions.TypeNameOrInfer);
|
|
18
19
|
const typeToken = typeExpr === null || typeExpr === void 0 ? void 0 : typeExpr.getFirstToken();
|
|
20
|
+
if (typeToken === undefined) {
|
|
21
|
+
throw new Error("NewObject, child TypeNameOrInfer not found");
|
|
22
|
+
}
|
|
19
23
|
const typeName = typeExpr === null || typeExpr === void 0 ? void 0 : typeExpr.concatTokens();
|
|
20
24
|
if (typeName === undefined) {
|
|
21
25
|
throw new assert_error_1.AssertError("NewObject, child TypeNameOrInfer not found");
|
|
@@ -23,7 +27,8 @@ class NewObject {
|
|
|
23
27
|
else if (typeName === "#" && targetType && targetType instanceof basic_1.ObjectReferenceType) {
|
|
24
28
|
const clas = input.scope.findClassDefinition(targetType.getIdentifierName());
|
|
25
29
|
if (clas) {
|
|
26
|
-
|
|
30
|
+
const tid = new _typed_identifier_1.TypedIdentifier(typeToken, input.filename, targetType);
|
|
31
|
+
input.scope.addReference(typeToken, tid, _reference_1.ReferenceType.InferredType, input.filename);
|
|
27
32
|
input.scope.addReference(typeToken, clas, _reference_1.ReferenceType.ConstructorReference, input.filename, { ooName: clas.getName() });
|
|
28
33
|
}
|
|
29
34
|
else {
|
|
@@ -55,14 +55,14 @@ class Source {
|
|
|
55
55
|
break;
|
|
56
56
|
case "BOOLC":
|
|
57
57
|
{
|
|
58
|
-
const method =
|
|
58
|
+
const method = _builtin_1.BuiltIn.searchBuiltin(tok);
|
|
59
59
|
input.scope.addReference(token, method, _reference_1.ReferenceType.BuiltinMethodReference, input.filename);
|
|
60
60
|
cond_1.Cond.runSyntax(node.findDirectExpression(Expressions.Cond), input);
|
|
61
61
|
return basic_1.StringType.get();
|
|
62
62
|
}
|
|
63
63
|
case "XSDBOOL":
|
|
64
64
|
{
|
|
65
|
-
const method =
|
|
65
|
+
const method = _builtin_1.BuiltIn.searchBuiltin(tok);
|
|
66
66
|
input.scope.addReference(token, method, _reference_1.ReferenceType.BuiltinMethodReference, input.filename);
|
|
67
67
|
cond_1.Cond.runSyntax(node.findDirectExpression(Expressions.Cond), input);
|
|
68
68
|
return new basic_1.CharacterType(1, { qualifiedName: "ABAP_BOOL", ddicName: "ABAP_BOOL" });
|
|
@@ -307,7 +307,8 @@ class Source {
|
|
|
307
307
|
if (typeName === "#" && inferredType && typeToken) {
|
|
308
308
|
const found = basic.lookupQualifiedName(inferredType.getQualifiedName());
|
|
309
309
|
if (found) {
|
|
310
|
-
|
|
310
|
+
const tid = new _typed_identifier_1.TypedIdentifier(typeToken, input.filename, inferredType);
|
|
311
|
+
input.scope.addReference(typeToken, tid, _reference_1.ReferenceType.InferredType, input.filename, { foundQualified: true });
|
|
311
312
|
}
|
|
312
313
|
else if (inferredType instanceof basic_1.ObjectReferenceType) {
|
|
313
314
|
const def = input.scope.findObjectDefinition(inferredType.getQualifiedName());
|
package/build/src/lsp/_lookup.js
CHANGED
|
@@ -214,7 +214,7 @@ class LSPLookup {
|
|
|
214
214
|
ret += "\n\n" + this.dumpType(ref.resolved);
|
|
215
215
|
}
|
|
216
216
|
else if (ref.referenceType === _reference_1.ReferenceType.BuiltinMethodReference) {
|
|
217
|
-
const builtinDef =
|
|
217
|
+
const builtinDef = _builtin_1.BuiltIn.searchBuiltin((_e = (_d = ref.resolved) === null || _d === void 0 ? void 0 : _d.getName()) === null || _e === void 0 ? void 0 : _e.toUpperCase());
|
|
218
218
|
if (builtinDef === undefined) {
|
|
219
219
|
return "Error: builtin method signature not found";
|
|
220
220
|
}
|
package/build/src/registry.js
CHANGED
|
@@ -2779,7 +2779,7 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
2779
2779
|
const spag = highSyntax.spaghetti.lookupPosition(high.getFirstToken().getStart(), lowFile.getFilename());
|
|
2780
2780
|
for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {
|
|
2781
2781
|
if (r.referenceType === _reference_1.ReferenceType.BuiltinMethodReference &&
|
|
2782
|
-
|
|
2782
|
+
_builtin_1.BuiltIn.isPredicate(chain.getFirstToken().getStr().toUpperCase())) {
|
|
2783
2783
|
predicate = true;
|
|
2784
2784
|
break;
|
|
2785
2785
|
}
|
|
@@ -2992,6 +2992,15 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
2992
2992
|
cdef = r.resolved;
|
|
2993
2993
|
}
|
|
2994
2994
|
}
|
|
2995
|
+
if (cdef instanceof _typed_identifier_1.TypedIdentifier) {
|
|
2996
|
+
const foo = cdef.getType();
|
|
2997
|
+
if (foo instanceof basic_1.ObjectReferenceType) {
|
|
2998
|
+
cdef = foo.getIdentifier();
|
|
2999
|
+
}
|
|
3000
|
+
else {
|
|
3001
|
+
throw new Error("newParameters, downport, unexpected");
|
|
3002
|
+
}
|
|
3003
|
+
}
|
|
2995
3004
|
if (cdef && cdef.getMethodDefinitions === undefined) {
|
|
2996
3005
|
return undefined; // something wrong
|
|
2997
3006
|
}
|
|
@@ -48,9 +48,8 @@ ENDCLASS.`,
|
|
|
48
48
|
for (const classDef of file.getInfo().listClassDefinitions()) {
|
|
49
49
|
methods = methods.concat(classDef.methods);
|
|
50
50
|
}
|
|
51
|
-
const builtIn = new _builtin_1.BuiltIn();
|
|
52
51
|
for (const method of methods) {
|
|
53
|
-
if (
|
|
52
|
+
if (_builtin_1.BuiltIn.searchBuiltin(method.name.toUpperCase())) {
|
|
54
53
|
const message = `Method name "${method.name}" overwrites built-in SAP function name`;
|
|
55
54
|
issues.push(issue_1.Issue.atIdentifier(method.identifier, message, this.getMetadata().key));
|
|
56
55
|
}
|