You can match PExpr using quotation, extract the name and then use it
again in quotation like:
match (typeName) {
<[ $(tname : name) ]> =>
<[ class $(tname : name) { public foo() : int { 1 } } ]>
}
The matching part is equivalent to
when (typeName is PExpr.Ref) {
def tname = (typeName :> PExpr.Ref).name
}
>
> I'm after something like this:
> macro Foo(typeName)
> {
> def n = ???
>
> create( <[ decl: public class $n { } ]> );
> }
>
> So far I've been doing
> def n = (typeName :> PExpr.Ref).name.Id
> and then
> $(n : dyn)
>
> This seems a bit messy... any ideas?
> >
>
--
Kamil Skalski
http://nazgul.omega.pl