@@ -90,7 +90,7 @@ function getterFn(path){
9090
9191var compileCache = { } ;
9292function expressionCompile ( exp ) {
93- if ( isFunction ( exp ) ) return exp ;
93+ if ( typeof exp === 'function' ) return exp ;
9494 var fn = compileCache [ exp ] ;
9595 if ( ! fn ) {
9696 var parser = new Parser ( exp ) ;
@@ -130,22 +130,28 @@ function createScope(parent, services, existing) {
130130 $set : bind ( instance , setter , instance ) ,
131131
132132 $eval : function $eval ( exp ) {
133- if ( exp !== undefined ) {
134- return expressionCompile ( exp ) . call ( instance ) ;
135- } else {
133+ if ( exp === undefined ) {
136134 for ( var i = 0 , iSize = evalLists . sorted . length ; i < iSize ; i ++ ) {
137135 for ( var queue = evalLists . sorted [ i ] ,
138- jSize = queue . length ,
139- j = 0 ; j < jSize ; j ++ ) {
136+ jSize = queue . length ,
137+ j = 0 ; j < jSize ; j ++ ) {
140138 instance . $tryEval ( queue [ j ] . fn , queue [ j ] . handler ) ;
141139 }
142140 }
141+ } else if ( typeof exp === 'function' ) {
142+ return exp . call ( instance ) ;
143+ } else {
144+ return expressionCompile ( exp ) . call ( instance ) ;
143145 }
144146 } ,
145147
146148 $tryEval : function ( expression , exceptionHandler ) {
147149 try {
148- return expressionCompile ( expression ) . call ( instance ) ;
150+ if ( typeof expression == 'function' ) {
151+ return expression . call ( instance ) ;
152+ } else {
153+ return expressionCompile ( expression ) . call ( instance ) ;
154+ }
149155 } catch ( e ) {
150156 ( instance . $log || { error :error } ) . error ( e ) ;
151157 if ( isFunction ( exceptionHandler ) ) {
0 commit comments