mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-09 20:33:30 -06:00
Address PR
This commit is contained in:
parent
b89ab66d1b
commit
c02816fead
@ -11766,10 +11766,6 @@ namespace ts {
|
||||
return;
|
||||
}
|
||||
|
||||
function isSuperCallExpression(n: Node): boolean {
|
||||
return n.kind === SyntaxKind.CallExpression && (<CallExpression>n).expression.kind === SyntaxKind.SuperKeyword;
|
||||
}
|
||||
|
||||
function containsSuperCallAsComputedPropertyName(n: Declaration): boolean {
|
||||
return n.name && containsSuperCall(n.name);
|
||||
}
|
||||
|
||||
@ -4768,21 +4768,22 @@ const _super = (function (geti, seti) {
|
||||
|
||||
/**
|
||||
* Return the statement at a given index if it is a super-call statement
|
||||
* @param ctor constructor declaration
|
||||
* @param ctor a constructor declaration
|
||||
* @param index an index to constructor's body to check
|
||||
*/
|
||||
function getSuperCallAtGivenIndex(ctor: ConstructorDeclaration, index: number): ExpressionStatement {
|
||||
if (ctor.body) {
|
||||
const statement = (<Block>ctor.body).statements[index];
|
||||
if (statement && statement.kind === SyntaxKind.ExpressionStatement) {
|
||||
const expr = (<ExpressionStatement>statement).expression;
|
||||
if (expr && expr.kind === SyntaxKind.CallExpression) {
|
||||
const func = (<CallExpression>expr).expression;
|
||||
if (func && func.kind === SyntaxKind.SuperKeyword) {
|
||||
return <ExpressionStatement>statement;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!ctor.body) {
|
||||
return undefined;
|
||||
}
|
||||
const statements = ctor.body.statements;
|
||||
|
||||
if (!statements || index >= statements.length) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const statement = statements[index];
|
||||
if (statement.kind === SyntaxKind.ExpressionStatement) {
|
||||
return isSuperCallExpression((<ExpressionStatement>statement).expression) ? <ExpressionStatement>statement : undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -464,6 +464,10 @@ namespace ts {
|
||||
return !!(getCombinedNodeFlags(node) & NodeFlags.Let);
|
||||
}
|
||||
|
||||
export function isSuperCallExpression(n: Node): boolean {
|
||||
return n.kind === SyntaxKind.CallExpression && (<CallExpression>n).expression.kind === SyntaxKind.SuperKeyword;
|
||||
}
|
||||
|
||||
export function isPrologueDirective(node: Node): boolean {
|
||||
return node.kind === SyntaxKind.ExpressionStatement && (<ExpressionStatement>node).expression.kind === SyntaxKind.StringLiteral;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user