1
Vote

Parser does not handle C# 3.0 class initialisation statement

description

Hi all,
 
Great work - I have found a bug parsing C# 3.0 and have attached a resolution to the bug
 
The code construct;
 
var people = new Person
{
Name="Fred",
Age = 24,
Bored = false
};
 
fails to parse.
 
The attachment contains three files;
Parser.cs (contains the new code to parse this type of object initialisation)
ObjectCreateAndInitExpression.cs (new expression node type for tracking member initialisation)
AbstractVisitor.cs (since the new node type requires a corresponding visitor method)
 
Well done on the codebase - it was relatively easy to find the appropriate place to add the code - although - I must admit I have not written the nicest code for parsing the code - sadly time is against me!
Hope you find the fix useful (after a suitable amount of cleaning!)
 
Regards,
Ade

file attachments

comments

DementedDevil wrote Dec 22, 2009 at 9:51 AM

Opps - missing attachment...

wrote Dec 22, 2009 at 9:51 AM

debreuil wrote Dec 22, 2009 at 5:58 PM

Thanks for the bug report and the fix! I'll make some tests and try to add it to the code base today : ).

wrote Feb 14, 2013 at 6:32 PM