@@ -3,7 +3,7 @@ var unparse = require('escodegen').generate;
3
3
module . exports = function ( ast , vars ) {
4
4
if ( ! vars ) vars = { } ;
5
5
var FAIL = { } ;
6
-
6
+
7
7
var result = ( function walk ( node , noExecute ) {
8
8
if ( node . type === 'Literal' ) {
9
9
return node . value ;
@@ -63,7 +63,7 @@ module.exports = function (ast, vars) {
63
63
if ( l === FAIL ) return FAIL ;
64
64
var r = walk ( node . right , noExecute ) ;
65
65
if ( r === FAIL ) return FAIL ;
66
-
66
+
67
67
if ( op === '==' ) return l == r ;
68
68
if ( op === '===' ) return l === r ;
69
69
if ( op === '!=' ) return l != r ;
@@ -80,7 +80,7 @@ module.exports = function (ast, vars) {
80
80
if ( op === '|' ) return l | r ;
81
81
if ( op === '&' ) return l & r ;
82
82
if ( op === '^' ) return l ^ r ;
83
-
83
+
84
84
return FAIL ;
85
85
}
86
86
else if ( node . type === 'Identifier' ) {
@@ -100,7 +100,7 @@ module.exports = function (ast, vars) {
100
100
if ( callee === FAIL ) return FAIL ;
101
101
if ( typeof callee !== 'function' ) return FAIL ;
102
102
103
-
103
+
104
104
var ctx = node . callee . object ? walk ( node . callee . object , noExecute ) : FAIL ;
105
105
if ( ctx === FAIL ) ctx = null ;
106
106
@@ -119,7 +119,7 @@ module.exports = function (ast, vars) {
119
119
}
120
120
else if ( node . type === 'MemberExpression' ) {
121
121
var obj = walk ( node . object , noExecute ) ;
122
- // do not allow access to methods on Function
122
+ // do not allow access to methods on Function
123
123
if ( ( obj === FAIL ) || ( typeof obj == 'function' ) ) {
124
124
return FAIL ;
125
125
}
@@ -147,7 +147,7 @@ module.exports = function (ast, vars) {
147
147
}
148
148
else if ( node . type === 'FunctionExpression' ) {
149
149
var bodies = node . body . body ;
150
-
150
+
151
151
// Create a "scope" for our arguments
152
152
var oldVars = { } ;
153
153
Object . keys ( vars ) . forEach ( function ( element ) {
@@ -168,7 +168,7 @@ module.exports = function (ast, vars) {
168
168
}
169
169
// restore the vars and scope after we walk
170
170
vars = oldVars ;
171
-
171
+
172
172
var keys = Object . keys ( vars ) ;
173
173
var vals = keys . map ( function ( key ) {
174
174
return vars [ key ] ;
@@ -196,7 +196,7 @@ module.exports = function (ast, vars) {
196
196
}
197
197
else return FAIL ;
198
198
} ) ( ast ) ;
199
-
199
+
200
200
return result === FAIL ? undefined : result ;
201
201
} ;
202
202
0 commit comments