File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 255
255
}
256
256
}
257
257
patches . push ( { from : tryPos , text : "try{" } ) ;
258
+ for ( var i = ast . body . length - 1 , catchPos = ast . end ; i >= 0 ; i -- ) {
259
+ var stat = ast . body [ i ] ;
260
+ if ( stat . type != "FunctionDeclaration" ) {
261
+ catchPos = stat . end ;
262
+ break ;
263
+ }
264
+ }
265
+ patches . push ( { from : catchPos , text : "}catch(e){__sandbox.error(e);}" } ) ;
258
266
patches . sort ( function ( a , b ) { return a . from - b . from ; } ) ;
259
267
var out = "" ;
260
268
for ( var i = 0 , pos = 0 ; i < patches . length ; ++ i ) {
263
271
pos = patch . to || patch . from ;
264
272
}
265
273
out += code . slice ( pos , code . length ) ;
266
- return ( strict ? '"use strict";' : "" ) + out + "\n}catch(e){__sandbox.error(e);}" ;
274
+ return ( strict ? '"use strict";' : "" ) + out ;
267
275
}
268
276
269
277
var Output = SandBox . Output = function ( div ) {
You can’t perform that action at this time.
0 commit comments