Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/compiler/binder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
var unreachableFlow: FlowNode = { flags: FlowFlags.Unreachable };
var reportedUnreachableFlow: FlowNode = { flags: FlowFlags.Unreachable };
var bindBinaryExpressionFlow = createBindBinaryExpressionFlow();
var alreadyBound: Set<Node>;
/* eslint-enable no-var */

return bindSourceFile;
Expand All @@ -567,6 +568,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
inStrictMode = bindInStrictMode(file, opts);
classifiableNames = new Set();
symbolCount = 0;
alreadyBound = new Set();

Symbol = objectAllocator.getSymbolConstructor();

Expand Down Expand Up @@ -604,6 +606,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
hasExplicitReturn = false;
inAssignmentPattern = false;
emitFlags = NodeFlags.None;
alreadyBound = undefined!;
}

function bindInStrictMode(file: SourceFile, opts: CompilerOptions): boolean {
Expand Down Expand Up @@ -2027,7 +2030,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
}

function bindJSDocClassTag(node: JSDocClassTag) {
bindEachChild(node);
// bindEachChild(node);
const host = getHostSignatureFromJSDoc(node);
if (host && host.kind !== SyntaxKind.MethodDeclaration) {
addDeclarationToSymbol(host.symbol, host, SymbolFlags.Class);
Expand Down Expand Up @@ -2640,6 +2643,10 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
if (!node) {
return;
}

Debug.assert(!alreadyBound.has(node), "This node has already been bound.");
alreadyBound.add(node);

setParent(node, parent);
if (tracing) (node as TracingNode).tracingPath = file.path;
const saveInStrictMode = inStrictMode;
Expand Down