You can type it code and and analyze it result:
...
typer.Manager.Solver.PushState();
try
{
match (pExpr)
{
| <[ $x = $_ ]> =>
def tExpr = typer.TypeExpr(x);
match (tExpr)
{
| TExpr...
}
}
}
finally { typer.Manager.Solver.PopState(); }
Or you can type all boby code (if it is correct) and then use
PExpr.TypeedObject property:
_ = typer.TypeExpr(body);
...
match (pExpr)
{
| <[ $x = $y ]> =>
match (x.TypeedObject)
{
| | TExpr...
}
}
--
С уважением,
Чистяков Владислав,
www.rsdn.ru
What goal of you macro?
I think, it should implement in compiler.
P.S.
You read about D approach?
http://www.google.com/url?sa=t&source=web&ct=res&cd=1&ved=0CAcQFjAA&url=http%3A%2F%2Fwww.digitalmars.com%2Fd%2F2.0%2Faccu-functional.pdf&ei=XoLUSuL8KNCJ_gbTgpzZAg&usg=AFQjCNEQkfr0-pCW-dOc8dCUgurVPsFa6g&sig2=jU9eA_iVd61PjvYQg5wJTQ
The bast place - a debugger! :)
Also, you can see DoType() method of Typer class
(https://nemerle.googlecode.com/svn/nemerle/trunk/ncc/typing/Typer.n)
If I am not wrong, field access can by TExpr.Member(x,
TExpr.FieldMember) or TExpr.FieldMember.
I think, you wrong. A TExpr.LocalRef refer into local variable.
Kamil, Im right?
Plus, I don't really see the need for the assembly level macro:
perform the check the first time it's necessary and cache the result
between macro invocations.
Adam
I think, this analysis should do in post typing process like Typer2 &
Typer3 classes (see it implementations) .
We can add entry point (event) which allow you add custom
"Typer-step". In this time, unfortunately, no PExpr-s exists, but
fortunately NOT exists Delayed-typer-actions and all macros will be
expended. It's very important!