[nem-en] patch for matching compiler (second take)

Kamil Skalski kamil.skalski at gmail.com
Tue Nov 1 13:30:53 CET 2005


>
> 2) To solve the problem with wrong line numbers in
>    warnings (a test case where matching was embedded in
>    a try-with block) I changed function ImplicitCast () in
>    typing/Typer.n so it sets location of TExpr.TypeConversion
>    node to that of casted expression.

It is enough to just use expr.loc in constructing the new TExpr node -
Util.locate is used to set up location context for entire execution of
embedded code, so during it all calls to Location_stack will return
the location saved by Util.locate.

>
>    unless (nem_compile.WaitForExit (20000) || nem_compile.HasExited)
>      nem_compile.Kill ();
>
>    This solves the problems I had with InvalidOperationException
>    on Mono (but again, this just works and I didn't put much effort
>    into investigating the source of the problem).

I think this is ok to have. Maybe there is a bug in mono, but
investigating it isn't a high priority since we now have a clean
workaround.

>
> - modify Con.FindValueExcept()/DecisionTreeBuilder.CheckMatching()
>   functions to not use exceptions to block unwanted warnings
>   (this was suggested by Kamil as throwing can be slow)

I checked how many throws are there and it seems to be not a real
problem - it's about 300 during N.C.dll compilation. It shouldn't have
any impact on performance, so let it stay just as a note for future
design/implementations. It's better to invest time to other issues.

The patch works for me with and without -new-matching option, so I
guess it is ok to commit. After release we can use -new-matching as
default, test and clean the code.

--
Kamil Skalski
http://nazgul.omega.pl



More information about the devel-en mailing list