Mercurial > projects > ldc
diff gen/tocall.cpp @ 758:f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Tue, 11 Nov 2008 01:38:48 +0100 |
parents | 55f6c2e454d7 |
children | 29f0e5847123 |
line wrap: on
line diff
--- a/gen/tocall.cpp Mon Nov 10 20:55:24 2008 +0100 +++ b/gen/tocall.cpp Tue Nov 11 01:38:48 2008 +0100 @@ -22,8 +22,9 @@ } else if (type->ty == Tdelegate) { - assert(type->next->ty == Tfunction); - return (TypeFunction*)type->next; + Type* next = type->nextOf(); + assert(next->ty == Tfunction); + return (TypeFunction*)next; } assert(0 && "cant get TypeFunction* from non lazy/function/delegate"); @@ -426,8 +427,8 @@ } } - #if 0 - Logger::println("%d params passed", n); + #if 1 + Logger::println("%lu params passed", args.size()); for (int i=0; i<args.size(); ++i) { assert(args[i]); Logger::cout() << "arg["<<i<<"] = " << *args[i] << '\n'; @@ -439,7 +440,7 @@ if (callableTy->getReturnType() != LLType::VoidTy) varname = "tmp"; - //Logger::cout() << "Calling: " << *funcval << '\n'; + Logger::cout() << "Calling: " << *callable << '\n'; // call the function CallOrInvoke* call = gIR->CreateCallOrInvoke(callable, args.begin(), args.end(), varname); @@ -451,10 +452,14 @@ if (resulttype) { Type* rbase = resulttype->toBasetype(); - Type* nextbase = tf->next->toBasetype(); + Type* nextbase = tf->nextOf()->toBasetype(); + #if DMDV2 + rbase = rbase->mutableOf(); + nextbase = nextbase->mutableOf(); + #endif if (!rbase->equals(nextbase)) { - Logger::println("repainting return value from '%s' to '%s'", tf->next->toChars(), rbase->toChars()); + Logger::println("repainting return value from '%s' to '%s'", tf->nextOf()->toChars(), rbase->toChars()); switch(rbase->ty) { case Tarray: