Пример #1
0
  gc<Chunk> ExprCompiler::compile(Module* module, FnExpr& function)
  {
    compile(module, function.resolved().maxLocals(),
            NULL, function.pattern(), NULL, function.body());

    // TODO(bob): Is this the right error?
    // If we get here, the argument didn't match the function's signature so
    // throw a NoMethodError.
    write(-1, OP_BUILT_IN, 3, 0);
    write(-1, OP_THROW, 0);

    chunk_->bind(maxSlots_, function.resolved().closures().count());
    return chunk_;
  }
Пример #2
0
 void Resolver::visit(FnExpr& expr, int dummy)
 {
   // Resolve the function itself.
   resolve(compiler_, module_, this, &expr.resolved(), false,
           NULL, expr.pattern(), NULL, expr.body());
 }