@@ -3,7 +3,7 @@ var unparse = require('escodegen').generate;
33module . exports = function ( ast , vars ) {
44 if ( ! vars ) vars = { } ;
55 var FAIL = { } ;
6-
6+
77 var result = ( function walk ( node , noExecute ) {
88 if ( node . type === 'Literal' ) {
99 return node . value ;
@@ -63,7 +63,7 @@ module.exports = function (ast, vars) {
6363 if ( l === FAIL ) return FAIL ;
6464 var r = walk ( node . right , noExecute ) ;
6565 if ( r === FAIL ) return FAIL ;
66-
66+
6767 if ( op === '==' ) return l == r ;
6868 if ( op === '===' ) return l === r ;
6969 if ( op === '!=' ) return l != r ;
@@ -80,7 +80,7 @@ module.exports = function (ast, vars) {
8080 if ( op === '|' ) return l | r ;
8181 if ( op === '&' ) return l & r ;
8282 if ( op === '^' ) return l ^ r ;
83-
83+
8484 return FAIL ;
8585 }
8686 else if ( node . type === 'Identifier' ) {
@@ -100,7 +100,7 @@ module.exports = function (ast, vars) {
100100 if ( callee === FAIL ) return FAIL ;
101101 if ( typeof callee !== 'function' ) return FAIL ;
102102
103-
103+
104104 var ctx = node . callee . object ? walk ( node . callee . object , noExecute ) : FAIL ;
105105 if ( ctx === FAIL ) ctx = null ;
106106
@@ -119,7 +119,7 @@ module.exports = function (ast, vars) {
119119 }
120120 else if ( node . type === 'MemberExpression' ) {
121121 var obj = walk ( node . object , noExecute ) ;
122- // do not allow access to methods on Function
122+ // do not allow access to methods on Function
123123 if ( ( obj === FAIL ) || ( typeof obj == 'function' ) ) {
124124 return FAIL ;
125125 }
@@ -147,7 +147,7 @@ module.exports = function (ast, vars) {
147147 }
148148 else if ( node . type === 'FunctionExpression' ) {
149149 var bodies = node . body . body ;
150-
150+
151151 // Create a "scope" for our arguments
152152 var oldVars = { } ;
153153 Object . keys ( vars ) . forEach ( function ( element ) {
@@ -168,7 +168,7 @@ module.exports = function (ast, vars) {
168168 }
169169 // restore the vars and scope after we walk
170170 vars = oldVars ;
171-
171+
172172 var keys = Object . keys ( vars ) ;
173173 var vals = keys . map ( function ( key ) {
174174 return vars [ key ] ;
@@ -196,7 +196,7 @@ module.exports = function (ast, vars) {
196196 }
197197 else return FAIL ;
198198 } ) ( ast ) ;
199-
199+
200200 return result === FAIL ? undefined : result ;
201201} ;
202202
0 commit comments