@@ -4,12 +4,11 @@ import {List, ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
44import { Injector , Key , Dependency , bind , Binding , NoProviderError , ProviderError , CyclicDependencyError } from 'angular2/di' ;
55import { Parent , Ancestor } from 'angular2/src/core/annotations/visibility' ;
66import { EventEmitter } from 'angular2/src/core/annotations/events' ;
7- import { onDestroy } from 'angular2/src/core/annotations/annotations' ;
87import { View , ProtoView } from 'angular2/src/core/compiler/view' ;
98import { LightDom , SourceLightDom , DestinationLightDom } from 'angular2/src/core/compiler/shadow_dom_emulation/light_dom' ;
109import { ViewPort } from 'angular2/src/core/compiler/viewport' ;
1110import { NgElement } from 'angular2/src/core/dom/element' ;
12- import { Directive } from 'angular2/src/core/annotations/annotations'
11+ import { Directive , onChange , onDestroy } from 'angular2/src/core/annotations/annotations'
1312import { BindingPropagationConfig } from 'angular2/src/core/compiler/binding_propagation_config'
1413
1514var _MAX_DIRECTIVE_CONSTRUCTION_COUNTER = 10 ;
@@ -123,18 +122,19 @@ export class DirectiveDependency extends Dependency {
123122
124123export class DirectiveBinding extends Binding {
125124 callOnDestroy :boolean ;
125+ callOnChange :boolean ;
126+ onCheck :boolean ;
126127
127- constructor ( key :Key , factory :Function , dependencies :List , providedAsPromise :boolean , callOnDestroy : boolean ) {
128+ constructor ( key :Key , factory :Function , dependencies :List , providedAsPromise :boolean , annotation : Directive ) {
128129 super ( key , factory , dependencies , providedAsPromise ) ;
129- this . callOnDestroy = callOnDestroy ;
130+ this . callOnDestroy = isPresent ( annotation ) && annotation . hasLifecycleHook ( onDestroy ) ;
131+ this . callOnChange = isPresent ( annotation ) && annotation . hasLifecycleHook ( onChange ) ;
132+ //this.onCheck = isPresent(annotation) && annotation.hasLifecycleHook(onCheck);
130133 }
131134
132135 static createFromBinding ( b :Binding , annotation :Directive ) :Binding {
133136 var deps = ListWrapper . map ( b . dependencies , DirectiveDependency . createFrom ) ;
134- var callOnDestroy = isPresent ( annotation ) && isPresent ( annotation . lifecycle ) ?
135- ListWrapper . contains ( annotation . lifecycle , onDestroy ) :
136- false ;
137- return new DirectiveBinding ( b . key , b . factory , deps , b . providedAsPromise , callOnDestroy ) ;
137+ return new DirectiveBinding ( b . key , b . factory , deps , b . providedAsPromise , annotation ) ;
138138 }
139139
140140 static createFromType ( type :Type , annotation :Directive ) :Binding {
@@ -567,7 +567,7 @@ export class ElementInjector extends TreeNode {
567567 return _undefined ;
568568 }
569569
570- getAtIndex ( index :int ) {
570+ getDirectiveAtIndex ( index :int ) {
571571 if ( index == 0 ) return this . _obj0 ;
572572 if ( index == 1 ) return this . _obj1 ;
573573 if ( index == 2 ) return this . _obj2 ;
@@ -581,6 +581,21 @@ export class ElementInjector extends TreeNode {
581581 throw new OutOfBoundsAccess ( index ) ;
582582 }
583583
584+ getDirectiveBindingAtIndex ( index :int ) {
585+ var p = this . _proto ;
586+ if ( index == 0 ) return p . _binding0 ;
587+ if ( index == 1 ) return p . _binding1 ;
588+ if ( index == 2 ) return p . _binding2 ;
589+ if ( index == 3 ) return p . _binding3 ;
590+ if ( index == 4 ) return p . _binding4 ;
591+ if ( index == 5 ) return p . _binding5 ;
592+ if ( index == 6 ) return p . _binding6 ;
593+ if ( index == 7 ) return p . _binding7 ;
594+ if ( index == 8 ) return p . _binding8 ;
595+ if ( index == 9 ) return p . _binding9 ;
596+ throw new OutOfBoundsAccess ( index ) ;
597+ }
598+
584599 hasInstances ( ) {
585600 return this . _constructionCounter > 0 ;
586601 }
0 commit comments