[nem-en] Typing a expression in context of method

vc vc at rsdn.ru
Sat May 12 02:38:49 CEST 2007


> This trick doe not work. If I try:
> ...
> mb.GetHeader().body = FunBody.Abstract();
> def typer = Typer(mb);
> ...
> compiler throw exception in Typer3.Run().

I foung temporary workaround: I generate fake code for method body:

def paramsUse = mb.Ast.header.ParametersReferences.Map(p => <[ _ = $p; ]>);
mb.GetHeader().body = FunBody.Parsed(<[ { ..$paramsUse }; null ]>);
def typer = Typer(mb);
...

But, it's very ugly :(.




More information about the devel-en mailing list