Attach return control flow graph to contructor declaration nodes
This commit is contained in:
parent
4b96edf72f
commit
f1762a04ea
2 changed files with 7 additions and 1 deletions
|
@ -514,8 +514,9 @@ namespace ts {
|
|||
if (containerFlags & (ContainerFlags.IsFunctionExpression | ContainerFlags.IsObjectLiteralOrClassExpressionMethod)) {
|
||||
(<FlowStart>currentFlow).container = <FunctionExpression | ArrowFunction | MethodDeclaration>node;
|
||||
}
|
||||
currentReturnTarget = undefined;
|
||||
currentReturnTarget = node.kind === SyntaxKind.Constructor ? createBranchLabel() : undefined;
|
||||
}
|
||||
currentReturnTarget = isIIFE || node.kind === SyntaxKind.Constructor ? createBranchLabel() : undefined;
|
||||
currentBreakTarget = undefined;
|
||||
currentContinueTarget = undefined;
|
||||
activeLabels = undefined;
|
||||
|
@ -535,6 +536,10 @@ namespace ts {
|
|||
currentFlow = finishFlowLabel(currentReturnTarget);
|
||||
}
|
||||
else {
|
||||
if (node.kind === SyntaxKind.Constructor) {
|
||||
addAntecedent(currentReturnTarget, currentFlow);
|
||||
(<ConstructorDeclaration>node).returnFlowNode = currentFlow;
|
||||
}
|
||||
currentFlow = saveCurrentFlow;
|
||||
}
|
||||
currentBreakTarget = saveBreakTarget;
|
||||
|
|
|
@ -929,6 +929,7 @@ namespace ts {
|
|||
kind: SyntaxKind.Constructor;
|
||||
parent?: ClassDeclaration | ClassExpression;
|
||||
body?: FunctionBody;
|
||||
returnFlowNode?: FlowNode;
|
||||
}
|
||||
|
||||
/** For when we encounter a semicolon in a class declaration. ES6 allows these as class elements. */
|
||||
|
|
Loading…
Reference in a new issue