[nem-en] Re: How field initializers are parsed?
Kamil Skalski
kamil.skalski at gmail.com
Sun Dec 17 01:03:48 CET 2006
You could fetch the initialization expression from
Nemerle.InternalMacros.StaticInitializer () attribute, which is a
macro generated by parser for
x : t = val;
fields.
It can be done by searching the
fBuider.GetModifiers().GetCustomAttributes() collection.
Maybe defining a property in FieldBuilder for accessing it would be
the best solution.
Note that initialization expression can be any arbitrary - it need not
to be just a literal, but some complex thing.
Well, the general idea for solving such cases would be to:
- create the subtypes of *Builder classes, which are designed to be
used by completion engine
- those Completion classes would contain the additional fields and
login useful for completion
- make the "factory" class available in Manager / CompletionEngine,
which could be used to construct the *Builder objects specific for
current flow
Storing initializer expression in the original FieldBuilder is of
course the easiest solution and not that bad in practice, but sooner
or later we should go into the more elegant approach - separating the
compiler and completion functionalities through OO subtyping mechanism
:)
Anyway, the fact that you got this method untyped looks like a bug -
probably completion engine does not run all the typing process
correctly.
2006/12/16, Andrey Khropov <andrey.khropov at gmail.com>:
> vc wrote:
>
> > > AKhropov
> >
> > My English is not fluent. Create topic on rsdn...
>
> I think Michal and Kamil should express their opinion on the subject (should we
> change FieldBuilder (and how) or not).
>
> --
> AKhropov
>
>
> _______________________________________________
> https://nemerle.org/mailman/listinfo/devel-en
>
--
Kamil Skalski
http://nazgul.omega.pl
More information about the devel-en
mailing list