[nem-en] Re: How field initializers are parsed?

Andrey Khropov andrey.khropov at gmail.com
Sat Dec 16 20:49:45 CET 2006


vc wrote:

> > This is caused by some fake code generated in
> > macros/Internals.n
> > 
> >     when (Nemerle.Macros.ImplicitCTX().Manager.IsIntelliSenseMode)
> >     { // Add fake method whith body of field initialiser.
> >       def n = "_N_field_initialiser__" + f.Name;
> >       //Fixme: VladD2: I not understand how add
> > NemerleAttributes.SpecialName to this method.
> >       Util.locate(val.Location,
> >         t.Define (<[ decl: private $(n : usesite) () : void { _ = $val; }
> > ]>));
> >     }
> > 
> > 
> > No idea why Vlad added this stuff...
> 
> Nemerle compiler can type only methods, but Integration need type field
> initializer expression.
> 
> In normal mode compiler add it's expressions to ctor. But Integration can't
> recognize it.

That's why I propose to have a 'initializer : TExpr' field in FieldBuilder. I
think it's a more appropriate and consistent solution (and will also help me
with CodeDom creation).

Maybe its initialization could be achieved by parsing BodyTyped of a kind of
such fake method (if we cannot type standalone expressions :( ), although it
looks like a dirty hack to me.

-- 
AKhropov




More information about the devel-en mailing list