Quantcast
Channel: SharpDevelop Community
Viewing all articles
Browse latest Browse all 1764

Get VariableInitializer of IField, when FieldDeclaration.Variables.Count>1

$
0
0

Hi Daniel,
i need to get the  VariableInitializer of IField, when FieldDeclaration.Variables.Count>1.

i have FieldDeclaration (with zwo  Variables), the TypeSystemConvertVisitor.VisitFieldDeclaration returns null, but generates internally zwo DefaultUnresolvedField.(another question: how to get the just generated DefaultUnresolvedField? In the Moment i made currentTypeDefinition public and simply get the last added fields.) As i see in VisitFieldDeclaration, no reference of VariableInitializer will set to DefaultUnresolvedField. So, i'm unable to get the correct reference or the index of FieldDeclaration.Variables[i].

My workarround is in the moment to set the reference with a bad hack of the nrefactory sources. Is there a better way?

When there's no more elegant way, i would suggest:
- A method like "VisitFieldDeclarationVariables", that returns a collection of DefaultUnresolvedField(normally only one item, but in this case two).
- Setting  a reference from VariableInitializer to DefaultUnresolvedField.
- maybe a reference in DefaultResolvedField, too, like "DefaultResolvedField.Inizializer" or so.

Greetings from Germany,
 Sebastian


Viewing all articles
Browse latest Browse all 1764

Trending Articles