gc<Chunk> ExprCompiler::compile(Module* module, AsyncExpr& expr)
  {
    compile(module, expr.resolved().maxLocals(),
            NULL, NULL, NULL, expr.body());

    chunk_->bind(maxSlots_, expr.resolved().closures().count());
    return chunk_;
  }
  void ExprCompiler::visit(AsyncExpr& expr, int dest)
  {
    // TODO(bob): Handle closures.
    ExprCompiler compiler(compiler_);
    gc<Chunk> chunk = compiler.compile(module_, expr);
    int index = chunk_->addChunk(chunk);

    write(expr.pos(), OP_ASYNC, index);
    // TODO(bob): What about dest?

    compileClosures(expr.pos(), expr.resolved());
  }
Exemple #3
0
 void Resolver::visit(AsyncExpr& expr, int dummy)
 {
   resolve(compiler_, module_, this, &expr.resolved(), false, NULL, NULL,
           NULL, expr.body());
 }