@@ -292,15 +292,6 @@ module ts {
292292 bindChildren ( node , symbolKind , isBlockScopeContainer ) ;
293293 }
294294
295- function bindConstructorDeclaration ( node : ConstructorDeclaration ) {
296- bindDeclaration ( node , SymbolFlags . Constructor , 0 , /*isBlockScopeContainer*/ true ) ;
297- forEach ( node . parameters , p => {
298- if ( p . flags & ( NodeFlags . Public | NodeFlags . Private | NodeFlags . Protected ) ) {
299- bindDeclaration ( p , SymbolFlags . Property , SymbolFlags . PropertyExcludes , /*isBlockScopeContainer*/ false ) ;
300- }
301- } ) ;
302- }
303-
304295 function bindModuleDeclaration ( node : ModuleDeclaration ) {
305296 if ( node . name . kind === SyntaxKind . StringLiteral ) {
306297 bindDeclaration ( node , SymbolFlags . ValueModule , SymbolFlags . ValueModuleExcludes , /*isBlockScopeContainer*/ true ) ;
@@ -389,12 +380,7 @@ module ts {
389380 bindDeclaration ( < Declaration > node , SymbolFlags . TypeParameter , SymbolFlags . TypeParameterExcludes , /*isBlockScopeContainer*/ false ) ;
390381 break ;
391382 case SyntaxKind . Parameter :
392- if ( isBindingPattern ( ( < Declaration > node ) . name ) ) {
393- bindAnonymousDeclaration ( < Declaration > node , SymbolFlags . FunctionScopedVariable , getDestructuringParameterName ( < Declaration > node ) , /*isBlockScopeContainer*/ false ) ;
394- }
395- else {
396- bindDeclaration ( < Declaration > node , SymbolFlags . FunctionScopedVariable , SymbolFlags . ParameterExcludes , /*isBlockScopeContainer*/ false ) ;
397- }
383+ bindParameter ( < ParameterDeclaration > node ) ;
398384 break ;
399385 case SyntaxKind . VariableDeclaration :
400386 case SyntaxKind . BindingElement :
@@ -437,7 +423,7 @@ module ts {
437423 bindDeclaration ( < Declaration > node , SymbolFlags . Function , SymbolFlags . FunctionExcludes , /*isBlockScopeContainer*/ true ) ;
438424 break ;
439425 case SyntaxKind . Constructor :
440- bindConstructorDeclaration ( < ConstructorDeclaration > node ) ;
426+ bindDeclaration ( < Declaration > node , SymbolFlags . Constructor , /*symbolExcludes:*/ 0 , /*isBlockScopeContainer:*/ true ) ;
441427 break ;
442428 case SyntaxKind . GetAccessor :
443429 bindDeclaration ( < Declaration > node , SymbolFlags . GetAccessor , SymbolFlags . GetAccessorExcludes , /*isBlockScopeContainer*/ true ) ;
@@ -508,5 +494,24 @@ module ts {
508494 parent = saveParent ;
509495 }
510496 }
497+
498+ function bindParameter ( node : ParameterDeclaration ) {
499+ if ( isBindingPattern ( node . name ) ) {
500+ bindAnonymousDeclaration ( node , SymbolFlags . FunctionScopedVariable , getDestructuringParameterName ( node ) , /*isBlockScopeContainer*/ false ) ;
501+ }
502+ else {
503+ bindDeclaration ( node , SymbolFlags . FunctionScopedVariable , SymbolFlags . ParameterExcludes , /*isBlockScopeContainer*/ false ) ;
504+ }
505+
506+ // If this is a property-parameter, then also declare the property symbol into the
507+ // containing class.
508+ if ( node . flags & NodeFlags . AccessibilityModifier &&
509+ node . parent . kind === SyntaxKind . Constructor &&
510+ node . parent . parent . kind === SyntaxKind . ClassDeclaration ) {
511+
512+ var classDeclaration = < ClassDeclaration > node . parent . parent ;
513+ declareSymbol ( classDeclaration . symbol . members , classDeclaration . symbol , node , SymbolFlags . Property , SymbolFlags . PropertyExcludes ) ;
514+ }
515+ }
511516 }
512517}
0 commit comments