Author: raja
Date: 2006-01-17 07:05:49 -0500 (Tue, 17 Jan 2006)
New Revision: 55676
Added:
trunk/mcs/errors/cs0201-2.cs
trunk/mcs/errors/cs0201-3.cs
Modified:
trunk/mcs/errors/ChangeLog
trunk/mcs/errors/known-issues-gmcs
trunk/mcs/mcs/ChangeLog
trunk/mcs/mcs/cs-parser.jay
trunk/mcs/mcs/doc.cs
Log:
Fix #76824.
* mcs/cs-parser.jay (statement_expression): Don't list out the
individual statement-expressions. Convert syntax error into
CS0201 check.
* errors/cs0201-2.cs, errors/cs0201-3.cs: New tests from #76824.
Modified: trunk/mcs/errors/ChangeLog
===================================================================
--- trunk/mcs/errors/ChangeLog 2006-01-17 11:54:14 UTC (rev 55675)
+++ trunk/mcs/errors/ChangeLog 2006-01-17 12:05:49 UTC (rev 55676)
@@ -1,3 +1,7 @@
+2006-01-17 Raja R Harinath <[EMAIL PROTECTED]>
+
+ * cs0201-2.cs, cs0201-3.cs: New tests from #76824.
+
2006-01-16 Raja R Harinath <[EMAIL PROTECTED]>
* cs1654.cs, cs1654-2, cs1656-4: New tests from #76874.
Added: trunk/mcs/errors/cs0201-2.cs
===================================================================
--- trunk/mcs/errors/cs0201-2.cs 2006-01-17 11:54:14 UTC (rev 55675)
+++ trunk/mcs/errors/cs0201-2.cs 2006-01-17 12:05:49 UTC (rev 55676)
@@ -0,0 +1,9 @@
+// cs0201-2.cs: Only assignment, call, increment, decrement, and new object
expressions can be used as a statement
+// Line: 7
+
+class T {
+ static string XX;
+ static void Main () {
+ T.XX;
+ }
+}
Property changes on: trunk/mcs/errors/cs0201-2.cs
___________________________________________________________________
Name: svn:mime-type
+ text/cpp
Name: svn:eol-style
+ native
Added: trunk/mcs/errors/cs0201-3.cs
===================================================================
--- trunk/mcs/errors/cs0201-3.cs 2006-01-17 11:54:14 UTC (rev 55675)
+++ trunk/mcs/errors/cs0201-3.cs 2006-01-17 12:05:49 UTC (rev 55676)
@@ -0,0 +1,11 @@
+// cs0201-3.cs: Only assignment, call, increment, decrement, and new object
expressions can be used as a statement
+// Line: 7
+
+class T {
+ static string XX {
+ get {return "";}
+ }
+ static void Main () {
+ T.XX;
+ }
+}
Property changes on: trunk/mcs/errors/cs0201-3.cs
___________________________________________________________________
Name: svn:mime-type
+ text/cpp
Name: svn:eol-style
+ native
Modified: trunk/mcs/errors/known-issues-gmcs
===================================================================
--- trunk/mcs/errors/known-issues-gmcs 2006-01-17 11:54:14 UTC (rev 55675)
+++ trunk/mcs/errors/known-issues-gmcs 2006-01-17 12:05:49 UTC (rev 55676)
@@ -11,6 +11,8 @@
# csXXXX.cs NO ERROR : error test case doesn't report any error. An
exception is considered
# as NO ERROR and CS5001 is automatically ignored.
+cs0201-2.cs
+cs0201-3.cs
cs0229-2.cs
cs0229.cs NO ERROR
cs0231-2.cs
Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog 2006-01-17 11:54:14 UTC (rev 55675)
+++ trunk/mcs/mcs/ChangeLog 2006-01-17 12:05:49 UTC (rev 55676)
@@ -1,3 +1,10 @@
+2006-01-17 Raja R Harinath <[EMAIL PROTECTED]>
+
+ Fix #76824.
+ * cs-parser.jay (statement_expression): Don't list out the
+ individual statement-expressions. Convert syntax error into
+ CS0201 check.
+
2006-01-16 Raja R Harinath <[EMAIL PROTECTED]>
Fix #76874.
Modified: trunk/mcs/mcs/cs-parser.jay
===================================================================
--- trunk/mcs/mcs/cs-parser.jay 2006-01-17 11:54:14 UTC (rev 55675)
+++ trunk/mcs/mcs/cs-parser.jay 2006-01-17 12:05:49 UTC (rev 55676)
@@ -3853,10 +3853,7 @@
;
expression_statement
- : statement_expression SEMICOLON
- {
- $$ = $1;
- }
+ : statement_expression SEMICOLON { $$ = $1; }
;
//
@@ -3864,14 +3861,18 @@
// because statement_expression is used for example in for_statement
//
statement_expression
- : invocation_expression { $$ = new StatementExpression
((ExpressionStatement) $1); }
- | object_creation_expression { $$ = new StatementExpression
((ExpressionStatement) $1); }
- | assignment_expression { $$ = new StatementExpression
((ExpressionStatement) $1); }
- | post_increment_expression { $$ = new StatementExpression
((ExpressionStatement) $1); }
- | post_decrement_expression { $$ = new StatementExpression
((ExpressionStatement) $1); }
- | pre_increment_expression { $$ = new StatementExpression
((ExpressionStatement) $1); }
- | pre_decrement_expression { $$ = new StatementExpression
((ExpressionStatement) $1); }
- | error {
+ : expression
+ {
+ Expression expr = (Expression) $1;
+ ExpressionStatement s = expr as ExpressionStatement;
+ if (s == null) {
+ Report.Error (201, expr.Location, "Only assignment,
call, increment, decrement, and new object expressions can be used as a
statement");
+ $$ = null;
+ }
+ $$ = new StatementExpression (s);
+ }
+ | error
+ {
Report.Error (1002, GetLocation ($1), "Expecting `;'");
$$ = null;
}
@@ -4886,6 +4887,7 @@
public void parse ()
{
+ int errors = Report.Errors;
try {
if (yacc_verbose_flag > 1)
yyparse (lexer, new yydebug.yyDebugSimple ());
@@ -4898,7 +4900,8 @@
// Removed for production use, use parser verbose to get the
output.
//
// Console.WriteLine (e);
- Report.Error (-25, lexer.Location, "Parsing error");
+ if (Report.Errors == errors)
+ Report.Error (-25, lexer.Location, "Parsing error");
if (yacc_verbose_flag > 0)
Console.WriteLine (e);
}
Modified: trunk/mcs/mcs/doc.cs
===================================================================
--- trunk/mcs/mcs/doc.cs 2006-01-17 11:54:14 UTC (rev 55675)
+++ trunk/mcs/mcs/doc.cs 2006-01-17 12:05:49 UTC (rev 55676)
@@ -30,8 +30,16 @@
//
// Support class for XML documentation.
//
- public static class DocUtil
+#if NET_2_0
+ static
+#else
+ abstract
+#endif
+ public class DocUtil
{
+#if !NET_2_0
+ private DocUtil () {}
+#endif
// TypeContainer
//
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches