[nem-en] How field initialisers are processed in the compiler?
Andrey Khropov
andrey.khropov at gmail.com
Sat Dec 16 14:37:11 CET 2006
Hello,
I noticed that when a field initialiser is present in the field declaration a
special hidden method is added to the class members, e.g.
for
-----------------------------------------------------------------------
private mutable components : System.ComponentModel.IContainer = null;
-----------------------------------------------------------------------
there will be
-----------------------------------------------------------------------
private _N_field_initialiser__components() : void ;
-----------------------------------------------------------------------
with its body is just {()} and fileIndex=0 for its Location. That's why a get
an assertion failure when calling BodyTyped method of it.
So I have a question: why is this method needed? Isn't it simpler to just add
'init_value : TExpr' field to FieldBuilder?
And why its body is just {()} instead of {null} ?
This issue may be VS integration-specific because I encountered it while
parsing Decls in Project.
--
AKhropov
More information about the devel-en
mailing list