Skip to content

Commit 8d7a88e

Browse files
authored
Port "Fixed crash in hasVisibleDeclarations related to binding elements" (#1820)
1 parent 647f179 commit 8d7a88e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

internal/checker/emitresolver.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,14 @@ func (r *emitResolver) hasVisibleDeclarations(symbol *ast.Symbol, shouldComputeA
409409
continue
410410
}
411411
if symbol.Flags&ast.SymbolFlagsBlockScopedVariable != 0 {
412-
variableStatement := ast.FindAncestor(declaration, ast.IsVariableStatement)
412+
rootDeclaration := ast.WalkUpBindingElementsAndPatterns(declaration)
413+
if ast.IsParameter(rootDeclaration) {
414+
return nil
415+
}
416+
variableStatement := rootDeclaration.Parent.Parent
417+
if !ast.IsVariableStatement(variableStatement) {
418+
return nil
419+
}
413420
if ast.HasSyntacticModifier(variableStatement, ast.ModifierFlagsExport) {
414421
continue // no alias to add, already exported
415422
}

0 commit comments

Comments
 (0)