Dump mixins (preprocessed/generated) code
Domingo Alvarez Duarte via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jul 18 04:39:07 PDT 2014
Hello !
I'm trying to make MiniD/Croc work with dmd2 and I'm having a
problem with this code and I want to know how to dump the
generated code to understand what's happening.
How that can be done ?
debugmixin.d-mixin-15(15): Error: no identifier for declarator
char[]
-----debugmixin.d
/// Eheheh, I has a __FUNCTION__.
const char[] FuncNameMix = "static if(!is(typeof(__FUNCTION__)))
{ struct __FUNCTION {} const char[] __FUNCTION__ =
_getJustName(__FUNCTION.mangleof); }";
template apiCheckNumParams(const char[] numParams, const char[] t
= "t")
{
const char[] apiCheckNumParams =
"debug assert(" ~ t ~ ".stackIndex > " ~ t ~ ".stackBase,
(printStack(" ~ t ~ "), printCallStack(" ~ t ~ "), \"fail.\"));" ~
FuncNameMix ~
"if((stackSize(" ~ t ~ ") - 1) < " ~ numParams ~ ")"
"throwStdException(" ~ t ~ ", \"ApiError\", __FUNCTION__ ~ \" -
not enough parameters (expected {}, only have {} stack slots)\",
" ~ numParams ~ ", stackSize(" ~ t ~ ") - 1);";
}
void setHookFunc(void* t, ubyte mask, uint hookDelay)
{
mixin(apiCheckNumParams!("1"));
}
void main()
{
}
-----
More information about the Digitalmars-d-learn
mailing list