From: Anirban Bhattacharjee Date: Thu, 27 May 2004 10:48:04 +0000 (-0000) Subject: * mb-parser.jay: Changed Delegate instantiation grammar to get it working X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=90acb9e77fcc5c4ffc778178d94b949373390f7b;p=mono.git * mb-parser.jay: Changed Delegate instantiation grammar to get it working svn path=/trunk/mcs/; revision=28247 --- diff --git a/mcs/mbas/ChangeLog b/mcs/mbas/ChangeLog index ba46168ed70..87e604069f2 100644 --- a/mcs/mbas/ChangeLog +++ b/mcs/mbas/ChangeLog @@ -1,3 +1,6 @@ +2004-05-27 Anirban Bhattacharjee + * mb-parser.jay: Changed Delegate instantiation grammar to get it working + 2004-05-26 Anirban Bhattacharjee * mb-parser.jay: * class.cs: diff --git a/mcs/mbas/mb-parser.jay b/mcs/mbas/mb-parser.jay index 48d85ed67f3..a1912e50237 100644 --- a/mcs/mbas/mb-parser.jay +++ b/mcs/mbas/mb-parser.jay @@ -2859,9 +2859,20 @@ array_creation_expression } ; +delegate_creation_expression + : NEW type OPEN_PARENS ADDRESSOF opt_argument_list CLOSE_PARENS + { + New n = new New ((Expression) $2, (ArrayList) $5, lexer.Location); + if (n==null) + Console.WriteLine("empty"); + $$ = n; + } + ; + new_expression : object_creation_expression | array_creation_expression + | delegate_creation_expression ; declaration_statement @@ -2873,7 +2884,6 @@ declaration_statement $$ = declare_local_variables ((Expression) de.Key, (ArrayList) de.Value, lexer.Location); } } - | local_constant_declaration { if ($1 != null){ @@ -3141,7 +3151,12 @@ opt_type_decl New n = new New ((Expression)$3, (ArrayList) $5, lexer.Location); $$ = (Expression) n; } - ; + | AS NEW type OPEN_PARENS ADDRESSOF opt_argument_list CLOSE_PARENS + { + New n = new New ((Expression)$3, (ArrayList) $6, lexer.Location); + $$ = (Expression) n; + } + ; opt_array_name_modifier : /* empty */ { $$ = null; } @@ -3551,12 +3566,6 @@ prefixed_unary_expression { $$ = new Unary (Unary.Operator.UnaryNegation, (Expression) $2, lexer.Location); } - | ADDRESSOF prefixed_unary_expression - { - // FIXME: We should generate an error if AddressOf is NOT used - // during delegate creation - $$ = $2; - } ; multiplicative_expression @@ -3706,6 +3715,15 @@ assignment_expression { $$ = new Assign ((Expression) $1, (Expression) $3, lexer.Location); } + /*| prefixed_unary_expression ASSIGN ADDRESSOF argument_list + { + // fixme: this is not working + // d = AddressOf F + // type of d has to get resolved somewhere + Console.WriteLine("right"); + New n = new New ((Expression) $1, (ArrayList) $4, lexer.Location); + $$ = new Assign ((Expression) $1, (Expression) n, lexer.Location); + }*/ | prefixed_unary_expression OP_MULT_ASSIGN expression { Location l = lexer.Location;