Author: gert
Date: 2005-06-25 15:26:41 -0400 (Sat, 25 Jun 2005)
New Revision: 46503
Modified:
trunk/mcs/class/System/ChangeLog
trunk/mcs/class/System/Microsoft.VisualBasic/ChangeLog
trunk/mcs/class/System/Microsoft.VisualBasic/VBCodeGenerator.cs
trunk/mcs/class/System/System_test.dll.sources
trunk/mcs/class/System/Test/Microsoft.VisualBasic/ChangeLog
trunk/mcs/class/System/Test/Microsoft.VisualBasic/CodeGeneratorFromTypeTest.cs
Log:
* CodeGeneratorFromTypeTest.cs: Added tests to verify code generated for
field and event members.
* System_test.dll.sources: Added System.CodeDom/CodeMemberFieldTest.cs
* VBCodeGenerator.cs: Removed type shortcuts that are not valid for VB.NET.
Fixed code generator for event and field level attributes. Dont' output
Overridable for events.
Modified: trunk/mcs/class/System/ChangeLog
===================================================================
--- trunk/mcs/class/System/ChangeLog 2005-06-25 19:23:08 UTC (rev 46502)
+++ trunk/mcs/class/System/ChangeLog 2005-06-25 19:26:41 UTC (rev 46503)
@@ -1,5 +1,10 @@
2005-06-25 Gert Driesen <[EMAIL PROTECTED]>
+ * System_test.dll.sources: Added CodeMemberFieldTest.cs from
+ System.CodeDom.
+
+2005-06-25 Gert Driesen <[EMAIL PROTECTED]>
+
* System_test.dll.sources: Added CodeGeneratorFromTypeTest.cs from
Microsoft.VisualBasic.
Modified: trunk/mcs/class/System/Microsoft.VisualBasic/ChangeLog
===================================================================
--- trunk/mcs/class/System/Microsoft.VisualBasic/ChangeLog 2005-06-25
19:23:08 UTC (rev 46502)
+++ trunk/mcs/class/System/Microsoft.VisualBasic/ChangeLog 2005-06-25
19:26:41 UTC (rev 46503)
@@ -1,5 +1,11 @@
2005-06-25 Gert Driesen <[EMAIL PROTECTED]>
+ * VBCodeGenerator.cs: Removed type shortcuts that are not valid for
+ VB.NET. Fixed generated code for event and field level attributes.
+ Don't output Overridable for events.
+
+2005-06-25 Gert Driesen <[EMAIL PROTECTED]>
+
* VBCodeGenerator.cs: Modified generated code for type-level
attributes to match MS.NET.
Modified: trunk/mcs/class/System/Microsoft.VisualBasic/VBCodeGenerator.cs
===================================================================
--- trunk/mcs/class/System/Microsoft.VisualBasic/VBCodeGenerator.cs
2005-06-25 19:23:08 UTC (rev 46502)
+++ trunk/mcs/class/System/Microsoft.VisualBasic/VBCodeGenerator.cs
2005-06-25 19:26:41 UTC (rev 46503)
@@ -569,12 +569,12 @@
TextWriter output = Output;
if (eventRef.CustomAttributes.Count > 0)
- OutputAttributeDeclarations
(eventRef.CustomAttributes);
+ OutputAttributes (eventRef.CustomAttributes,
null, true);
MemberAttributes attributes = eventRef.Attributes;
OutputMemberAccessModifier (attributes);
- OutputMemberScopeModifier (attributes);
+ OutputMemberScopeModifier (attributes |
MemberAttributes.Final); // Don't output "Overridable"
output.Write ("Event ");
OutputTypeNamePair (eventRef.Type, eventRef.Name);
@@ -586,7 +586,7 @@
TextWriter output = Output;
if (field.CustomAttributes.Count > 0)
- OutputAttributeDeclarations
(field.CustomAttributes);
+ OutputAttributes (field.CustomAttributes, null,
true);
MemberAttributes attributes = field.Attributes;
OutputMemberAccessModifier (attributes);
@@ -1218,7 +1218,6 @@
output = GetTypeOutput (arrayType);
else {
switch (type.BaseType) {
-
case "System.Decimal":
output = "Decimal";
break;
@@ -1228,51 +1227,30 @@
case "System.Single":
output = "Single";
break;
-
case "System.Byte":
output = "Byte";
break;
- case "System.SByte":
- output = "SByte";
- break;
case "System.Int32":
output = "Integer";
break;
- case "System.UInt32":
- output = "UInt32";
- break;
case "System.Int64":
output = "Long";
break;
- case "System.UInt64":
- output = "UInt64";
- break;
case "System.Int16":
output = "Short";
break;
- case "System.UInt16":
- output = "UInt16";
- break;
-
case "System.Boolean":
output = "Boolean";
break;
-
case "System.Char":
output = "Char";
break;
-
case "System.String":
output = "String";
break;
case "System.Object":
output = "Object";
break;
-
- case "System.Void":
- output = "Nothing";
- break;
-
default:
output = type.BaseType;
break;
Modified: trunk/mcs/class/System/System_test.dll.sources
===================================================================
--- trunk/mcs/class/System/System_test.dll.sources 2005-06-25 19:23:08 UTC
(rev 46502)
+++ trunk/mcs/class/System/System_test.dll.sources 2005-06-25 19:26:41 UTC
(rev 46503)
@@ -13,6 +13,7 @@
System/UriBuilderTest.cs
System/UriTest.cs
System/UriTest2.cs
+System.CodeDom/CodeMemberFieldTest.cs
System.CodeDom.Compiler/IndentedTextWriterTest.cs
System.Collections.Generic/QueueTest.cs
System.Collections.Generic/StackTest.cs
Modified: trunk/mcs/class/System/Test/Microsoft.VisualBasic/ChangeLog
===================================================================
--- trunk/mcs/class/System/Test/Microsoft.VisualBasic/ChangeLog 2005-06-25
19:23:08 UTC (rev 46502)
+++ trunk/mcs/class/System/Test/Microsoft.VisualBasic/ChangeLog 2005-06-25
19:26:41 UTC (rev 46503)
@@ -1,6 +1,11 @@
2005-06-25 Gert Driesen <[EMAIL PROTECTED]>
* CodeGeneratorFromTypeTest.cs: Added tests to verify code generated
+ for field and event members.
+
+2005-06-25 Gert Driesen <[EMAIL PROTECTED]>
+
+ * CodeGeneratorFromTypeTest.cs: Added tests to verify code generated
for Type (with and without custom attributes).
2005-06-25 Gert Driesen <[EMAIL PROTECTED]>
Modified:
trunk/mcs/class/System/Test/Microsoft.VisualBasic/CodeGeneratorFromTypeTest.cs
===================================================================
---
trunk/mcs/class/System/Test/Microsoft.VisualBasic/CodeGeneratorFromTypeTest.cs
2005-06-25 19:23:08 UTC (rev 46502)
+++
trunk/mcs/class/System/Test/Microsoft.VisualBasic/CodeGeneratorFromTypeTest.cs
2005-06-25 19:26:41 UTC (rev 46503)
@@ -83,5 +83,87 @@
"<A(), _{0} B()> _{0}Public Class Test1{0}End
Class{0}",
writer.NewLine), Code);
}
+
+ [Test]
+ public void EventMembersTypeTest1 ()
+ {
+ type.Name = "Test1";
+
+ CodeMemberEvent evt = new CodeMemberEvent ();
+
+ CodeAttributeDeclaration attrDec = new
CodeAttributeDeclaration ();
+ attrDec.Name = "A";
+ evt.CustomAttributes.Add (attrDec);
+
+ attrDec = new CodeAttributeDeclaration ();
+ attrDec.Name = "B";
+ evt.CustomAttributes.Add (attrDec);
+
+ type.Members.Add (evt);
+
+ Generate ();
+ Assertion.AssertEquals (string.Format
(CultureInfo.InvariantCulture,
+ "Public Class Test1{0} {0} <A(), _{0}
B()> _{0} "
+ + "Private Event As System.Void{0}End
Class{0}", writer.NewLine), Code);
+ }
+
+ [Test]
+ public void EventMembersTypeTest2 ()
+ {
+ type.Name = "Test1";
+
+ CodeMemberEvent evt = new CodeMemberEvent ();
+ evt.Name = "OnClick";
+ evt.Attributes = MemberAttributes.Public;
+ evt.Type = new CodeTypeReference(typeof (int));
+ type.Members.Add (evt);
+
+ Generate ();
+ Assertion.AssertEquals (string.Format
(CultureInfo.InvariantCulture,
+ "Public Class Test1{0} {0} "
+ + "Public Event OnClick As Integer{0}"
+ + "End Class{0}", writer.NewLine), Code);
+ }
+
+ [Test]
+ public void FieldMembersTypeTest1 ()
+ {
+ type.Name = "Test1";
+
+ CodeMemberField fld = new CodeMemberField ();
+
+ CodeAttributeDeclaration attrDec = new
CodeAttributeDeclaration ();
+ attrDec.Name = "A";
+ fld.CustomAttributes.Add (attrDec);
+
+ attrDec = new CodeAttributeDeclaration ();
+ attrDec.Name = "B";
+ fld.CustomAttributes.Add (attrDec);
+
+ type.Members.Add (fld);
+
+ Generate ();
+ Assertion.AssertEquals (string.Format
(CultureInfo.InvariantCulture,
+ "Public Class Test1{0} {0} <A(), _{0}
B()> _{0} "
+ + "Private As System.Void{0}End Class{0}",
writer.NewLine), Code);
+ }
+
+ [Test]
+ public void FieldMembersTypeTest2 ()
+ {
+ type.Name = "Test1";
+
+ CodeMemberField fld = new CodeMemberField ();
+ fld.Name = "Name";
+ fld.Attributes = MemberAttributes.Public;
+ fld.Type = new CodeTypeReference (typeof (int));
+ type.Members.Add (fld);
+
+ Generate ();
+ Assertion.AssertEquals (string.Format
(CultureInfo.InvariantCulture,
+ "Public Class Test1{0} {0} "
+ + "Public Name As Integer{0}"
+ + "End Class{0}", writer.NewLine), Code);
+ }
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches