@abaplint/cli 2.120.67 → 2.120.68
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/cli.js +94 -1
- package/package.json +2 -3
package/build/cli.js
CHANGED
|
@@ -26579,6 +26579,17 @@ class CurrentScope {
|
|
|
26579
26579
|
var _a;
|
|
26580
26580
|
return ((_a = this.localFriends.get(className.toUpperCase())) === null || _a === void 0 ? void 0 : _a.includes(friendName.toUpperCase())) === true;
|
|
26581
26581
|
}
|
|
26582
|
+
getEnclosingMethodName() {
|
|
26583
|
+
let curr = this.current;
|
|
26584
|
+
while (curr !== undefined) {
|
|
26585
|
+
const stype = curr.getIdentifier().stype;
|
|
26586
|
+
if (stype === _scope_type_1.ScopeType.Method || stype === _scope_type_1.ScopeType.MethodInstance) {
|
|
26587
|
+
return curr.getIdentifier().sname;
|
|
26588
|
+
}
|
|
26589
|
+
curr = curr.getParent();
|
|
26590
|
+
}
|
|
26591
|
+
return undefined;
|
|
26592
|
+
}
|
|
26582
26593
|
getEnclosingClassName() {
|
|
26583
26594
|
let curr = this.current;
|
|
26584
26595
|
while (curr !== undefined) {
|
|
@@ -26842,6 +26853,42 @@ class ObjectOriented {
|
|
|
26842
26853
|
}
|
|
26843
26854
|
return "private";
|
|
26844
26855
|
}
|
|
26856
|
+
// the fixture methods of a test class are called by ABAP Unit only, returns the message otherwise
|
|
26857
|
+
checkSpecialTestMethodCall(method, foundDef) {
|
|
26858
|
+
if (method === undefined
|
|
26859
|
+
|| !(foundDef instanceof types_1.ClassDefinition)
|
|
26860
|
+
|| foundDef.isForTesting() === false) {
|
|
26861
|
+
return undefined;
|
|
26862
|
+
}
|
|
26863
|
+
const name = method.getName().toUpperCase();
|
|
26864
|
+
if (["SETUP", "TEARDOWN", "CLASS_SETUP", "CLASS_TEARDOWN"].includes(name) === false) {
|
|
26865
|
+
return undefined;
|
|
26866
|
+
}
|
|
26867
|
+
return `The special method "${name}" cannot be called directly`;
|
|
26868
|
+
}
|
|
26869
|
+
// SUPER-> can only call the previous implementation of the method it is used in, returns the message otherwise
|
|
26870
|
+
// both names are resolved in the super class, so an alias and the method it stands for are the same
|
|
26871
|
+
checkSuperCall(superDef, methodName) {
|
|
26872
|
+
const enclosing = this.scope.getEnclosingMethodName();
|
|
26873
|
+
if (methodName === undefined
|
|
26874
|
+
|| enclosing === undefined
|
|
26875
|
+
|| methodName.toUpperCase() === enclosing.toUpperCase()) {
|
|
26876
|
+
return undefined;
|
|
26877
|
+
}
|
|
26878
|
+
const message = "SUPER-> can only be used to call the previous implementation of the same method";
|
|
26879
|
+
// a method that is not a redefinition has no previous implementation
|
|
26880
|
+
const enclosingClass = this.scope.findClassDefinition(this.scope.getEnclosingClassName());
|
|
26881
|
+
const ownDefinition = enclosingClass === null || enclosingClass === void 0 ? void 0 : enclosingClass.getMethodDefinitions().getByName(enclosing);
|
|
26882
|
+
if (ownDefinition !== undefined && ownDefinition.isRedefinition() === false) {
|
|
26883
|
+
return message;
|
|
26884
|
+
}
|
|
26885
|
+
const called = this.searchMethodName(superDef, methodName).method;
|
|
26886
|
+
const own = this.searchMethodName(superDef, enclosing).method;
|
|
26887
|
+
if (called === undefined || own === undefined || called === own) {
|
|
26888
|
+
return undefined;
|
|
26889
|
+
}
|
|
26890
|
+
return message;
|
|
26891
|
+
}
|
|
26845
26892
|
// the class declaring the attribute or constant, searched from def up through the super classes
|
|
26846
26893
|
findAttributeOwner(def, found) {
|
|
26847
26894
|
const visited = [];
|
|
@@ -32840,6 +32887,14 @@ class MethodCallChain {
|
|
|
32840
32887
|
const methodToken = (_a = current.findDirectExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
32841
32888
|
const methodName = methodToken === null || methodToken === void 0 ? void 0 : methodToken.getStr();
|
|
32842
32889
|
const def = input.scope.findObjectDefinition(className);
|
|
32890
|
+
const isSuper = current === children[2]
|
|
32891
|
+
&& first.get() instanceof Expressions.FieldChain
|
|
32892
|
+
&& first.concatTokens().toUpperCase() === "SUPER";
|
|
32893
|
+
const superMessage = isSuper ? helper.checkSuperCall(def, methodName) : undefined;
|
|
32894
|
+
if (superMessage !== undefined) {
|
|
32895
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, methodToken, superMessage));
|
|
32896
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
32897
|
+
}
|
|
32843
32898
|
// eslint-disable-next-line prefer-const
|
|
32844
32899
|
let { method, def: foundDef } = helper.searchMethodName(def, methodName);
|
|
32845
32900
|
if (method === undefined && current === first) {
|
|
@@ -32867,6 +32922,11 @@ class MethodCallChain {
|
|
|
32867
32922
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, methodToken, message));
|
|
32868
32923
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
32869
32924
|
}
|
|
32925
|
+
const specialMessage = isSuper ? undefined : helper.checkSpecialTestMethodCall(method, foundDef);
|
|
32926
|
+
if (specialMessage !== undefined) {
|
|
32927
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, methodToken, specialMessage));
|
|
32928
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
32929
|
+
}
|
|
32870
32930
|
const voidedName = context instanceof basic_1.VoidType ? context.getVoided() : undefined;
|
|
32871
32931
|
const extra = helper.methodReferenceExtras(foundDef, className || voidedName);
|
|
32872
32932
|
input.scope.addReference(methodToken, method, _reference_1.ReferenceType.MethodReference, input.filename, extra);
|
|
@@ -33730,6 +33790,14 @@ class MethodSource {
|
|
|
33730
33790
|
const methodToken = current.getFirstToken();
|
|
33731
33791
|
const methodName = methodToken === null || methodToken === void 0 ? void 0 : methodToken.getStr();
|
|
33732
33792
|
const def = input.scope.findObjectDefinition(className);
|
|
33793
|
+
const isSuper = implicitMe === false
|
|
33794
|
+
&& first.get() instanceof Expressions.SourceField
|
|
33795
|
+
&& first.concatTokens().toUpperCase() === "SUPER";
|
|
33796
|
+
const superMessage = isSuper ? helper.checkSuperCall(def, methodName) : undefined;
|
|
33797
|
+
if (superMessage !== undefined) {
|
|
33798
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, methodToken, superMessage));
|
|
33799
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
33800
|
+
}
|
|
33733
33801
|
// eslint-disable-next-line prefer-const
|
|
33734
33802
|
let { method, def: foundDef } = helper.searchMethodName(def, methodName);
|
|
33735
33803
|
if (implicitMe && current === first && (method === null || method === void 0 ? void 0 : method.isStatic()) === false && input.scope.isInStaticMethod() === true) {
|
|
@@ -33746,6 +33814,11 @@ class MethodSource {
|
|
|
33746
33814
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
33747
33815
|
}
|
|
33748
33816
|
else if (method) {
|
|
33817
|
+
const specialMessage = isSuper ? undefined : helper.checkSpecialTestMethodCall(method, foundDef);
|
|
33818
|
+
if (specialMessage !== undefined) {
|
|
33819
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, methodToken, specialMessage));
|
|
33820
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
33821
|
+
}
|
|
33749
33822
|
const extra = helper.methodReferenceExtras(foundDef, className);
|
|
33750
33823
|
input.scope.addReference(methodToken, method, _reference_1.ReferenceType.MethodReference, input.filename, extra);
|
|
33751
33824
|
context = method;
|
|
@@ -34844,6 +34917,7 @@ const corresponding_body_1 = __webpack_require__(/*! ./corresponding_body */ "..
|
|
|
34844
34917
|
const _builtin_1 = __webpack_require__(/*! ../_builtin */ "../core/build/src/abap/5_syntax/_builtin.js");
|
|
34845
34918
|
const attribute_chain_1 = __webpack_require__(/*! ./attribute_chain */ "../core/build/src/abap/5_syntax/expressions/attribute_chain.js");
|
|
34846
34919
|
const dereference_1 = __webpack_require__(/*! ./dereference */ "../core/build/src/abap/5_syntax/expressions/dereference.js");
|
|
34920
|
+
const cast_1 = __webpack_require__(/*! ./cast */ "../core/build/src/abap/5_syntax/expressions/cast.js");
|
|
34847
34921
|
const _typed_identifier_1 = __webpack_require__(/*! ../../types/_typed_identifier */ "../core/build/src/abap/types/_typed_identifier.js");
|
|
34848
34922
|
const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "../core/build/src/abap/5_syntax/_type_utils.js");
|
|
34849
34923
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
@@ -35067,6 +35141,10 @@ class Source {
|
|
|
35067
35141
|
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
35068
35142
|
}
|
|
35069
35143
|
}
|
|
35144
|
+
else if (get instanceof Expressions.Cast) {
|
|
35145
|
+
const found = cast_1.Cast.runSyntax(first, input, targetType);
|
|
35146
|
+
context = arithmetic === true ? this.infer(context, found, true) : found;
|
|
35147
|
+
}
|
|
35070
35148
|
else if (get instanceof Expressions.FieldChain) {
|
|
35071
35149
|
const found = field_chain_1.FieldChain.runSyntax(first, input, type, allowGenericDeference);
|
|
35072
35150
|
context = arithmetic === true ? this.infer(context, found, true) : found;
|
|
@@ -35083,6 +35161,11 @@ class Source {
|
|
|
35083
35161
|
context = this.infer(context, found, arithmetic);
|
|
35084
35162
|
}
|
|
35085
35163
|
else if (get instanceof Expressions.Dereference) {
|
|
35164
|
+
if (this.isNewObjectDereference(node, first)) {
|
|
35165
|
+
const message = "NEW cannot be dereferenced directly";
|
|
35166
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, first.getFirstToken(), message));
|
|
35167
|
+
return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
|
|
35168
|
+
}
|
|
35086
35169
|
context = dereference_1.Dereference.runSyntax(first, context, input);
|
|
35087
35170
|
}
|
|
35088
35171
|
else if (get instanceof Expressions.ComponentChain) {
|
|
@@ -35270,6 +35353,16 @@ class Source {
|
|
|
35270
35353
|
}
|
|
35271
35354
|
return targetType;
|
|
35272
35355
|
}
|
|
35356
|
+
// "NEW ty( )->*" is a syntax error, also in releases where a method call can be dereferenced
|
|
35357
|
+
static isNewObjectDereference(node, deref) {
|
|
35358
|
+
var _a;
|
|
35359
|
+
const children = node.getChildren();
|
|
35360
|
+
const before = children[children.indexOf(deref) - 1];
|
|
35361
|
+
return before instanceof nodes_1.ExpressionNode
|
|
35362
|
+
&& before.get() instanceof Expressions.MethodCallChain
|
|
35363
|
+
&& before.getChildren().length === 1
|
|
35364
|
+
&& ((_a = before.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.NewObject;
|
|
35365
|
+
}
|
|
35273
35366
|
}
|
|
35274
35367
|
exports.Source = Source;
|
|
35275
35368
|
//# sourceMappingURL=source.js.map
|
|
@@ -70392,7 +70485,7 @@ class Registry {
|
|
|
70392
70485
|
}
|
|
70393
70486
|
static abaplintVersion() {
|
|
70394
70487
|
// magic, see build script "version.js"
|
|
70395
|
-
return "2.120.
|
|
70488
|
+
return "2.120.68";
|
|
70396
70489
|
}
|
|
70397
70490
|
getDDICReferences() {
|
|
70398
70491
|
return this.ddicReferences;
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
2
|
"name": "@abaplint/cli",
|
|
4
|
-
"version": "2.120.
|
|
3
|
+
"version": "2.120.68",
|
|
5
4
|
"description": "abaplint - Command Line Interface",
|
|
6
5
|
"funding": "https://github.com/sponsors/larshp",
|
|
7
6
|
"bin": {
|
|
@@ -40,7 +39,7 @@
|
|
|
40
39
|
},
|
|
41
40
|
"homepage": "https://abaplint.org",
|
|
42
41
|
"devDependencies": {
|
|
43
|
-
"@abaplint/core": "^2.120.
|
|
42
|
+
"@abaplint/core": "^2.120.68",
|
|
44
43
|
"@types/chai": "^4.3.20",
|
|
45
44
|
"@types/minimist": "^1.2.5",
|
|
46
45
|
"@types/mocha": "^10.0.10",
|