[Mono-bugs] [Bug 60247][Maj] New - Mono.CSharp.CSharpCodeGenerator.GenerateLabeledStatement method code is incorrect
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 15 Jun 2004 21:11:55 -0400 (EDT)
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 alex@x-tensive.com.
http://bugzilla.ximian.com/show_bug.cgi?id=60247
--- shadow/60247 2004-06-15 21:11:55.000000000 -0400
+++ shadow/60247.tmp.5535 2004-06-15 21:11:55.000000000 -0400
@@ -0,0 +1,47 @@
+Bug#: 60247
+Product: Mono: Compilers
+Version: unspecified
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Major
+Component: C#
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: alex@x-tensive.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Mono.CSharp.CSharpCodeGenerator.GenerateLabeledStatement method code is incorrect
+
+Mono.CSharp.CSharpCodeGenerator.GenerateLabeledStatement method code is
+incorrect:
+1) It doesn't append ":" after the label;
+2) NullReferenceException will be thrown if statement.Statement==null
+(native CodeDom allows this - there is a corresponding constructor for
+CodeLabeledStatement, and its C# CodeDom provider handles this situation
+correctly).
+
+Current implementation:
+ protected override void GenerateLabeledStatement(
+CodeLabeledStatement statement )
+ {
+ TextWriter output = Output;
+
+ output.Write( GetSafeName (statement.Label) );
+ GenerateStatement( statement.Statement );
+ }
+
+Proposed update:
+ protected override void GenerateLabeledStatement(
+CodeLabeledStatement statement )
+ {
+ TextWriter output = Output;
+
+ output.Write( GetSafeName (statement.Label)
++ ": " );
+ if ( statement.Statement!=null )
+ GenerateStatement( statement.Statement );
+ }