static void setProperty(TypePtr type, ProcedurePtr proc, const vector<ExprPtr> &exprs) { CodePtr code = new Code(); TypePtr typeType = staticType(type.ptr()); ExprPtr argType = new ObjectExpr(typeType.ptr()); FormalArgPtr arg = new FormalArg(new Identifier("x"), argType); code->formalArgs.push_back(arg.ptr()); ExprListPtr returnExprs = new ExprList(); for (unsigned i = 0; i < exprs.size(); ++i) returnExprs->add(exprs[i]); code->body = new Return(RETURN_VALUE, returnExprs); ExprPtr target = new ObjectExpr(proc.ptr()); OverloadPtr overload = new Overload(target, code, false, false); overload->env = new Env(); proc->overloads.insert(proc->overloads.begin(), overload); }
static void addOperator(ModulePtr module, llvm::StringRef name) { IdentifierPtr ident = Identifier::get(name); ProcedurePtr opProc = new Procedure(module.ptr(), ident, PUBLIC, false); opProc->env = new Env(module); addGlobal(module, ident, PUBLIC, opProc.ptr()); }
static void addOperator(ModulePtr module, const string &name) { IdentifierPtr ident = new Identifier(name); ProcedurePtr opProc = new Procedure(ident, PUBLIC); opProc->env = new Env(module); addGlobal(module, ident, PUBLIC, opProc.ptr()); }