mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Merge pull request #4124 from ShyykoSerhiy/fix-3991
Fix for "Error for missing 'super' call is misleading"
This commit is contained in:
commit
54f3b414f7
11 files changed
+290
-6
No files matched your search
+10
-6
@@ -10470,17 +10470,21 @@ namespace ts {
|
||||
return n.kind === SyntaxKind.CallExpression && (<CallExpression>n).expression.kind === SyntaxKind.SuperKeyword;
|
||||
}
|
||||
|
||||
function containsSuperCallAsComputedPropertyName(n: Declaration): boolean {
|
||||
return n.name && containsSuperCall(n.name);
|
||||
}
|
||||
|
||||
function containsSuperCall(n: Node): boolean {
|
||||
if (isSuperCallExpression(n)) {
|
||||
return true;
|
||||
}
|
||||
switch (n.kind) {
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.ObjectLiteralExpression: return false;
|
||||
default: return forEachChild(n, containsSuperCall);
|
||||
else if (isFunctionLike(n)) {
|
||||
return false;
|
||||
}
|
||||
else if (isClassLike(n)) {
|
||||
return forEach((<ClassLikeDeclaration>n).members, containsSuperCallAsComputedPropertyName);
|
||||
}
|
||||
return forEachChild(n, containsSuperCall);
|
||||
}
|
||||
|
||||
function markThisReferencesAsErrors(n: Node): void {
|
||||
|
||||
Reference in new issue
Block a user