     ###
     returns [err, str]
     ###
-    script = @_toScriptObj()
+    script = @_toScriptObj(ctx)
     res    = null
     if not @error
       try
-        ctx['__toffee_run_input'] = options
-        vm.runInContext(script, ctx)
-#        sandbox = { __toffee_run_input: options }
-#        script.runInNewContext sandbox
-        res = ctx.__toffee_run_input.__toffee.res
-#        delete sandbox.__toffee_run_input.__toffee
+        res = script options
       catch e
         @error = new toffeeError @, errorTypes.RUNTIME, e
 


  _coffeeHeaders: ->
    ___  = @_tabAsSpaces()

    """
#{if @browserMode then '' else getCommonHeaders false, @autoEscape }
tmpl = toffee.templates["#{@bundlePath}"]  =
  bundlePath: "#{@bundlePath}"
tmpl.render = tmpl.pub = (__locals) ->
#{___}_to = (x) -> __locals.__toffee.out.push x
#{___}_ln = (x) -> __locals.__toffee.lineno = x
#{___}_ts = (x) -> __locals.__toffee.state  = x
#{___}toffee.__augmentLocals __locals, "#{@bundlePath}"

#{___}`with (__locals) {`
#{___}__toffee.out = []
"""

  _coffeeFooters: ->
    ___    = @_tabAsSpaces()
    """\n
#{___}__toffee.res = __toffee.out.join ""
#{___}return __toffee.res
#{___}`true; } /* closing JS 'with' */ `
# sometimes we want to execute the whole thing in a sandbox
# and just output results
if __toffee_run_input?
#{___}return tmpl.pub __toffee_run_input
"""

exports.view                = view
exports.getCommonHeaders    = getCommonHeaders


    @tokenObj

  _toScriptObj: (ctx) ->
    if not @scriptObj?
      txt = @toJavaScript()
      if not @error
        d = Date.now()
        vm.runInContext(txt, ctx)
        @scriptObj = ctx['_TMPL_']
        @_log "#{@fileName} compiled to scriptObj in #{Date.now()-d}ms"
    @scriptObj

