[Mono-bugs] [Bug 54934][Wis] New - CodeDOM - CodeMethodReturnStatement() fails to generate C# code

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 27 Feb 2004 10:11:00 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by jaak@zd.com.pl.

http://bugzilla.ximian.com/show_bug.cgi?id=54934

--- shadow/54934	2004-02-27 10:11:00.000000000 -0500
+++ shadow/54934.tmp.8279	2004-02-27 10:11:00.000000000 -0500
@@ -0,0 +1,41 @@
+Bug#: 54934
+Product: Mono/Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: jaak@zd.com.pl               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: CodeDOM - CodeMethodReturnStatement() fails to generate C# code
+
+CodeMethodReturnStatement object fails on C# code generation when its
+argument is null (nothing to be returned)
+
+The following one-line-patch fixes this. Can you commit it?
+
+Index: CSharpCodeGenerator.cs
+===================================================================
+RCS file: /mono/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs,v
+retrieving revision 1.16
+diff -u -r1.16 CSharpCodeGenerator.cs
+--- CSharpCodeGenerator.cs      27 Feb 2004 12:12:02 -0000      1.16
++++ CSharpCodeGenerator.cs      27 Feb 2004 16:01:45 -0000
+@@ -308,7 +308,9 @@
+
+                        output.Write( "return " );
+
+-                       GenerateExpression( statement.Expression );
++                       if (statement.Expression != null) {
++                               GenerateExpression( statement.Expression );
++                       }
+
+                        output.WriteLine ( ";" );
+                }