Browse Source

2002-10-19 Rachel Hestilow <[email protected]>

	* CSharpCodeProvider.cs
	(GeneratePropertySetValueReferenceExpression): Implement.
	(GenerateField, GenerateMethod): Only call OutputAttributeDeclarations
	if there are any attributes.
	(GenerateProperty): Implement.

svn path=/trunk/mcs/; revision=8383
Rachel Hestilow 23 years ago
parent
commit
6d6aeca7ea

+ 43 - 5
mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs

@@ -237,10 +237,9 @@ namespace Mono.CSharp
 							   expression.PropertyName );
 		}
 
-		// TODO
 		protected override void GeneratePropertySetValueReferenceExpression( CodePropertySetValueReferenceExpression expression )
 		{
-			
+			Output.Write ( "value" );	
 		}
 
 		protected override void GenerateThisReferenceExpression( CodeThisReferenceExpression expression )
@@ -444,7 +443,8 @@ namespace Mono.CSharp
 		{
 			TextWriter output = Output;
 
-			OutputAttributeDeclarations( field.CustomAttributes );
+			if (field.CustomAttributes.Count > 0)
+				OutputAttributeDeclarations( field.CustomAttributes );
 
 			MemberAttributes attributes = field.Attributes;
 			OutputMemberAccessModifier( attributes );
@@ -478,7 +478,8 @@ namespace Mono.CSharp
 		{
 			TextWriter output = Output;
 
-			OutputAttributeDeclarations( method.CustomAttributes );
+			if (method.CustomAttributes.Count > 0)
+				OutputAttributeDeclarations( method.CustomAttributes );
 
 			MemberAttributes attributes = method.Attributes;
 
@@ -515,7 +516,44 @@ namespace Mono.CSharp
 							  CodeTypeDeclaration declaration )
 		{
 			TextWriter output = Output;
-			output.Write( "<GenerateProperty>" );
+
+			if (property.CustomAttributes.Count > 0)
+				OutputAttributeDeclarations( property.CustomAttributes );
+
+			MemberAttributes attributes = property.Attributes;
+			OutputMemberAccessModifier( attributes );
+			OutputFieldScopeModifier( attributes );
+
+			OutputTypeNamePair( property.Type, property.Name );
+			output.WriteLine (" {");
+			++Indent;
+
+			if (property.HasGet)
+			{
+				output.WriteLine ("get {");
+				++Indent;
+
+				GenerateStatements (property.GetStatements);
+				output.WriteLine ();
+
+				output.WriteLine ("}");
+				--Indent;
+			}
+			
+			if (property.HasSet)
+			{
+				output.WriteLine ("set {");
+				++Indent;
+
+				GenerateStatements (property.SetStatements);
+				output.WriteLine ();
+
+				output.WriteLine ("}");
+				--Indent;
+			}
+
+			--Indent;
+			output.WriteLine ("}");
 		}
 
 		protected override void GenerateConstructor( CodeConstructor constructor,

+ 8 - 0
mcs/class/System/Microsoft.CSharp/ChangeLog

@@ -1,3 +1,11 @@
+2002-10-19  Rachel Hestilow <[email protected]>
+
+	* CSharpCodeProvider.cs
+	(GeneratePropertySetValueReferenceExpression): Implement.
+	(GenerateField, GenerateMethod): Only call OutputAttributeDeclarations
+	if there are any attributes.
+	(GenerateProperty): Implement.
+	 
 2002-10-11  Duncan Mak  <[email protected]>
 
 	* CSharpCodeProvider.cs: Fix constructor visibility.