예제 #1
0
static string lambdaName(LambdaPtr x)
{
    string fullName = shortString(x->asString());

    if (fullName.size() <= 80)
        return "(" + fullName + ")";
    else {
        ostringstream shortName;
        shortName << "<lambda ";
        printFileLineCol(shortName, x->location);
        shortName << ">";

        return shortName.str();
    }
}
예제 #2
0
static SourcePtr evalToSource(Location const &location, ExprListPtr args, EnvPtr env)
{
    llvm::SmallString<128> sourceTextBuf;
    llvm::raw_svector_ostream sourceTextOut(sourceTextBuf);
    MultiStaticPtr values = evaluateMultiStatic(args, env);
    for (size_t i = 0; i < values->size(); ++i) {
        printStaticName(sourceTextOut, values->values[i]);
    }

    llvm::SmallString<128> sourceNameBuf;
    llvm::raw_svector_ostream sourceNameOut(sourceNameBuf);
    sourceNameOut << "<eval ";
    printFileLineCol(sourceNameOut, location);
    sourceNameOut << ">";

    sourceTextOut.flush();
    return new Source(sourceNameOut.str(),
        llvm::MemoryBuffer::getMemBufferCopy(sourceTextBuf));
}