Skip to content

Commit

Permalink
2010-05-05 Miguel de Icaza <miguel@novell.com>
Browse files Browse the repository at this point in the history
	* cs-parser.jay: Productions to catch common mistakes when other
	punctuation operators are used instead of comma.   Fixes 571702	


svn path=/trunk/mcs/; revision=156757
  • Loading branch information
migueldeicaza committed May 5, 2010
1 parent 4cb0513 commit cb373a0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
12 changes: 12 additions & 0 deletions mcs/errors/cs1003-2.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// CS1003: Syntax error, `.' expected
// Line: 9
class X {
public int Field;

static void Main ()
{
var x = new X () {
Field = 1;
};
}
}
5 changes: 5 additions & 0 deletions mcs/mcs/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2010-05-05 Miguel de Icaza <miguel@novell.com>

* cs-parser.jay: Productions to catch common mistakes when other
punctuation operators are used instead of comma. Fixes 571702

2010-05-05 Marek Safar <marek.safar@gmail.com>

* anonymous.cs: Mutate correct set of constraints.
Expand Down
13 changes: 12 additions & 1 deletion mcs/mcs/cs-parser.jay
Original file line number Diff line number Diff line change
Expand Up @@ -3160,6 +3160,10 @@ member_initializer_list
a.Add ((Expression) $3);
$$ = a;
}
| member_initializer_list error {
Report.Error (1003, GetLocation ($1), "Syntax error, expecting ','");
$$ = null;
}
;

member_initializer
Expand All @@ -3181,7 +3185,10 @@ member_initializer
}
| OPEN_BRACE expression_list CLOSE_BRACE
{
$$ = new CollectionElementInitializer ((List<Expression>)$2, GetLocation ($1));
if ($2 == null)
$$ = null;
else
$$ = new CollectionElementInitializer ((List<Expression>)$2, GetLocation ($1));
}
| OPEN_BRACE CLOSE_BRACE
{
Expand Down Expand Up @@ -3330,6 +3337,10 @@ expression_list
list.Add ((Expression) $3);
$$ = list;
}
| expression_list error {
Report.Error (1003, GetLocation ($1), "Syntax error, expecting ','");
$$ = null;
}
;

expression_list_arguments
Expand Down

0 comments on commit cb373a0

Please sign in to comment.