@@ -16,7 +16,7 @@ import {
1616 InjectableMetadata ,
1717 VisibilityMetadata ,
1818 OptionalMetadata ,
19- unbounded ,
19+ DEFAULT_VISIBILITY ,
2020 DependencyMetadata
2121} from './metadata' ;
2222import { NoAnnotationError } from './exceptions' ;
@@ -30,7 +30,7 @@ export class Dependency {
3030 public properties : List < any > ) { }
3131
3232 static fromKey ( key : Key ) : Dependency {
33- return new Dependency ( key , false , _defaulVisiblity ( key . token ) , [ ] ) ;
33+ return new Dependency ( key , false , DEFAULT_VISIBILITY , [ ] ) ;
3434 }
3535}
3636
@@ -397,18 +397,16 @@ function _extractToken(typeOrFunc, annotations /*List<any> | any*/, params: List
397397 var optional = false ;
398398
399399 if ( ! isArray ( annotations ) ) {
400- return _createDependency ( annotations , optional , _defaulVisiblity ( annotations ) , depProps ) ;
400+ return _createDependency ( annotations , optional , DEFAULT_VISIBILITY , depProps ) ;
401401 }
402402
403- var visibility = null ;
404- var defaultVisibility = unbounded ;
403+ var visibility = DEFAULT_VISIBILITY ;
405404
406405 for ( var i = 0 ; i < annotations . length ; ++ i ) {
407406 var paramAnnotation = annotations [ i ] ;
408407
409408 if ( paramAnnotation instanceof Type ) {
410409 token = paramAnnotation ;
411- defaultVisibility = _defaulVisiblity ( token ) ;
412410
413411 } else if ( paramAnnotation instanceof InjectMetadata ) {
414412 token = paramAnnotation . token ;
@@ -427,10 +425,6 @@ function _extractToken(typeOrFunc, annotations /*List<any> | any*/, params: List
427425 }
428426 }
429427
430- if ( isBlank ( visibility ) ) {
431- visibility = defaultVisibility ;
432- }
433-
434428 token = resolveForwardRef ( token ) ;
435429
436430 if ( isPresent ( token ) ) {
@@ -439,16 +433,6 @@ function _extractToken(typeOrFunc, annotations /*List<any> | any*/, params: List
439433 throw new NoAnnotationError ( typeOrFunc , params ) ;
440434 }
441435}
442- function _defaulVisiblity ( typeOrFunc ) {
443- if ( ! ( typeOrFunc instanceof Type ) ) return unbounded ;
444-
445- // TODO: vsavkin revisit this after clarifying lookup rules
446- if ( ! reflector . isReflectionEnabled ( ) ) return unbounded ;
447-
448- var f =
449- ListWrapper . filter ( reflector . annotations ( typeOrFunc ) , s => s instanceof InjectableMetadata ) ;
450- return f . length === 0 ? unbounded : f [ 0 ] . visibility ;
451- }
452436
453437function _createDependency ( token , optional , visibility , depProps ) : Dependency {
454438 return new Dependency ( Key . get ( token ) , optional , visibility , depProps ) ;
0 commit comments