Author: rolf
Date: 2007-12-21 13:45:39 -0500 (Fri, 21 Dec 2007)
New Revision: 91780
Modified:
trunk/mcs/class/System/Microsoft.VisualBasic/ChangeLog
trunk/mcs/class/System/Microsoft.VisualBasic/VBCodeGenerator.cs
trunk/mcs/class/System/Test/Microsoft.CSharp/ChangeLog
trunk/mcs/class/System/Test/Microsoft.CSharp/CodeGeneratorFromTypeTest.cs
trunk/mcs/class/System/Test/Microsoft.VisualBasic/ChangeLog
trunk/mcs/class/System/Test/Microsoft.VisualBasic/CodeGeneratorFromTypeTest.cs
trunk/mcs/class/System/Test/System.CodeDom.Compiler/ChangeLog
trunk/mcs/class/System/Test/System.CodeDom.Compiler/CodeGeneratorFromTypeTestBase.cs
Log:
* Test/Microsoft.CSharp/CodeGeneratorFromTypeTest.cs,
Test/System.CodeDom.Compiler/CodeGeneratorFromTypeTestBase.cs,
Test/Microsoft.VisualBasic/CodeGeneratorFromTypeTest.cs: Added
PartialTypeTest.
* Microsoft.VisualBasic/VBCodeGenerator.cs: Split array of keywords in
two, one for 1.1 and one for 2.0. Add some 2.0 specific keywords.
When writing a type, escape the name of the type if necessary.
Output "Partial" if a type is partial.
Modified: trunk/mcs/class/System/Microsoft.VisualBasic/ChangeLog
===================================================================
--- trunk/mcs/class/System/Microsoft.VisualBasic/ChangeLog 2007-12-21
17:56:47 UTC (rev 91779)
+++ trunk/mcs/class/System/Microsoft.VisualBasic/ChangeLog 2007-12-21
18:45:39 UTC (rev 91780)
@@ -1,3 +1,9 @@
+2007-12-21 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
+
+ * VBCodeGenerator.cs: Split array of keywords in two, one for 1.1 and
one
+ for 2.0. Add some 2.0 specific keywords. When writing a type, escape
the
+ name of the type if necessary. Output "Partial" if a type is partial.
+
2007-12-14 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
* VBCodeProvider.cs: Implement constructor added in 2.0SP1.
Modified: trunk/mcs/class/System/Microsoft.VisualBasic/VBCodeGenerator.cs
===================================================================
--- trunk/mcs/class/System/Microsoft.VisualBasic/VBCodeGenerator.cs
2007-12-21 17:56:47 UTC (rev 91779)
+++ trunk/mcs/class/System/Microsoft.VisualBasic/VBCodeGenerator.cs
2007-12-21 18:45:39 UTC (rev 91780)
@@ -56,6 +56,7 @@
{
internal class VBCodeGenerator : CodeGenerator
{
+#if NET_2_0
private string[] Keywords = new string[] {
"AddHandler", "AddressOf", "Alias", "And",
"AndAlso", "Ansi", "As", "Assembly",
@@ -71,6 +72,44 @@
"End", "Enum", "Erase", "Error",
"Event", "Exit", "False", "Finally",
"For", "Friend", "Function", "Get",
+ "GetType", "Global", "GoSub", "GoTo", "Handles",
+ "If", "Implements", "Imports", "In",
+ "Inherits", "Integer", "Interface", "Is",
+ "Let", "Lib", "Like", "Long",
+ "Loop", "Me", "Mod", "Module",
+ "MustInherit", "MustOverride", "MyBase", "MyClass",
+ "Namespace", "New", "Next", "Not",
+ "Nothing", "NotInheritable", "NotOverridable",
"Object",
+ "On", "Option", "Optional", "Or",
+ "OrElse", "Overloads", "Overridable", "Overrides",
+ "ParamArray", "Partial", "Preserve", "Private",
"Property",
+ "Protected", "Public", "RaiseEvent", "ReadOnly",
+ "ReDim", "REM", "RemoveHandler", "Resume",
+ "Return", "Select", "Set", "Shadows",
+ "Shared", "Short", "Single", "Static",
+ "Step", "Stop", "String", "Structure",
+ "Sub", "SyncLock", "Then", "Throw",
+ "To", "True", "Try", "TypeOf",
+ "Unicode", "Until", "Variant", "When",
+ "While", "With", "WithEvents", "WriteOnly",
+ "Xor"
+ };
+#else
+ private string[] Keywords = new string[] {
+ "AddHandler", "AddressOf", "Alias", "And",
+ "AndAlso", "Ansi", "As", "Assembly",
+ "Auto", "Boolean", "ByRef", "Byte",
+ "ByVal", "Call", "Case", "Catch",
+ "CBool", "CByte", "CChar", "CDate",
+ "CDec", "CDbl", "Char", "CInt",
+ "Class", "CLng", "CObj", "Const",
+ "CShort", "CSng", "CStr", "CType",
+ "Date", "Decimal", "Declare", "Default",
+ "Delegate", "Dim", "DirectCast", "Do",
+ "Double", "Each", "Else", "ElseIf",
+ "End", "Enum", "Erase", "Error",
+ "Event", "Exit", "False", "Finally",
+ "For", "Friend", "Function", "Get",
"GetType", "GoSub", "GoTo", "Handles",
"If", "Implements", "Imports", "In",
"Inherits", "Integer", "Interface", "Is",
@@ -93,6 +132,7 @@
"While", "With", "WithEvents", "WriteOnly",
"Xor"
};
+#endif
public VBCodeGenerator()
{
@@ -979,7 +1019,7 @@
output.Write ("Delegate Function ");
}
- output.Write (delegateDecl.Name);
+ output.Write (CreateEscapedIdentifier
(delegateDecl.Name));
output.Write ("(");
OutputParameters (delegateDecl.Parameters);
Output.Write (")");
@@ -991,7 +1031,7 @@
} else {
OutputTypeAttributes (declaration);
- output.Write (declaration.Name);
+ output.Write (CreateEscapedIdentifier
(declaration.Name));
if (IsCurrentEnum) {
if (declaration.BaseTypes.Count > 0) {
@@ -1357,6 +1397,11 @@
TextWriter output = Output;
TypeAttributes attributes = declaration.TypeAttributes;
+#if NET_2_0
+ if (declaration.IsPartial)
+ output.Write ("Partial ");
+#endif
+
switch (attributes & TypeAttributes.VisibilityMask) {
case TypeAttributes.Public:
case TypeAttributes.NestedPublic:
Modified: trunk/mcs/class/System/Test/Microsoft.CSharp/ChangeLog
===================================================================
--- trunk/mcs/class/System/Test/Microsoft.CSharp/ChangeLog 2007-12-21
17:56:47 UTC (rev 91779)
+++ trunk/mcs/class/System/Test/Microsoft.CSharp/ChangeLog 2007-12-21
18:45:39 UTC (rev 91780)
@@ -1,3 +1,7 @@
+2007-12-21 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
+
+ * CodeGeneratorFromTypeTest.cs: Added PartialTypeTest.
+
2007-10-26 Atsushi Enomoto <[EMAIL PROTECTED]>
* CodeGeneratorFromTypeTest.cs : added test case for escaped
Modified:
trunk/mcs/class/System/Test/Microsoft.CSharp/CodeGeneratorFromTypeTest.cs
===================================================================
--- trunk/mcs/class/System/Test/Microsoft.CSharp/CodeGeneratorFromTypeTest.cs
2007-12-21 17:56:47 UTC (rev 91779)
+++ trunk/mcs/class/System/Test/Microsoft.CSharp/CodeGeneratorFromTypeTest.cs
2007-12-21 18:45:39 UTC (rev 91780)
@@ -955,6 +955,17 @@
"}}{0}", NewLine), code);
}
#endif
+
+#if NET_2_0
+ [Test]
+ public override void PartialTypeTest ()
+ {
+ string code = GeneratePartialType (Options);
+ Assert.AreEqual (string.Format
(CultureInfo.InvariantCulture,
+ "public partial class Test1 {{{0}" +
+ "}}{0}", NewLine), code);
+ }
+#endif
}
[TestFixture]
@@ -1439,6 +1450,17 @@
"}}{0}", NewLine), code);
}
+#if NET_2_0
+ [Test]
+ public override void PartialTypeTest ()
+ {
+ string code = GeneratePartialType (Options);
+ Assert.AreEqual (string.Format
(CultureInfo.InvariantCulture,
+ "public delegate void Test1();{0}"
+ , NewLine), code);
+ }
+#endif
+
#endregion Override implementation of
CodeGeneratorFromTypeTestBase
}
@@ -2191,6 +2213,16 @@
"}}{0}", NewLine), code);
}
+#if NET_2_0
+ [Test]
+ public override void PartialTypeTest ()
+ {
+ string code = GeneratePartialType (Options);
+ Assert.AreEqual (string.Format
(CultureInfo.InvariantCulture,
+ "public partial interface Test1 {{{0}" +
+ "}}{0}", NewLine), code);
+ }
+#endif
#endregion Override implementation of
CodeGeneratorFromTypeTestBase
}
@@ -3031,6 +3063,16 @@
"}}{0}", NewLine), code);
}
+#if NET_2_0
+ [Test]
+ public override void PartialTypeTest ()
+ {
+ string code = GeneratePartialType (Options);
+ Assert.AreEqual (string.Format
(CultureInfo.InvariantCulture,
+ "public partial struct Test1 {{{0}" +
+ "}}{0}", NewLine), code);
+ }
+#endif
#endregion Override implementation of
CodeGeneratorFromTypeTestBase
}
@@ -3684,6 +3726,17 @@
"}}{0}", NewLine), code);
}
+#if NET_2_0
+ [Test]
+ public override void PartialTypeTest ()
+ {
+ string code = GeneratePartialType (Options);
+ Assert.AreEqual (string.Format
(CultureInfo.InvariantCulture,
+ "public enum Test1 {{{0}" +
+ "}}{0}", NewLine), code);
+ }
+#endif
+
#endregion Override implementation of
CodeGeneratorFromTypeTestBase
}
}
Modified: trunk/mcs/class/System/Test/Microsoft.VisualBasic/ChangeLog
===================================================================
--- trunk/mcs/class/System/Test/Microsoft.VisualBasic/ChangeLog 2007-12-21
17:56:47 UTC (rev 91779)
+++ trunk/mcs/class/System/Test/Microsoft.VisualBasic/ChangeLog 2007-12-21
18:45:39 UTC (rev 91780)
@@ -1,3 +1,7 @@
+2007-12-21 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
+
+ * CodeGeneratorFromTypeTest.cs: Added PartialTypeTest.
+
2007-10-30 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
* CodeGeneratorFromExpressionTest.cs: Added ArrayIndexerExpressionTest.
Modified:
trunk/mcs/class/System/Test/Microsoft.VisualBasic/CodeGeneratorFromTypeTest.cs
===================================================================
---
trunk/mcs/class/System/Test/Microsoft.VisualBasic/CodeGeneratorFromTypeTest.cs
2007-12-21 17:56:47 UTC (rev 91779)
+++
trunk/mcs/class/System/Test/Microsoft.VisualBasic/CodeGeneratorFromTypeTest.cs
2007-12-21 18:45:39 UTC (rev 91780)
@@ -878,6 +878,17 @@
" End Sub{0}" +
"End Class{0}", NewLine), code);
}
+
+#if NET_2_0
+ [Test]
+ public override void PartialTypeTest ()
+ {
+ string code = GeneratePartialType (Options);
+ Assert.AreEqual (string.Format
(CultureInfo.InvariantCulture,
+ "Partial Public Class Test1{0}" +
+ "End Class{0}", NewLine), code);
+ }
+#endif
}
[TestFixture]
@@ -1364,6 +1375,16 @@
Assert.AreEqual (string.Format
(CultureInfo.InvariantCulture,
"Public Delegate Sub A(ByVal param As
type){0}", NewLine), code);
}
+
+#if NET_2_0
+ [Test]
+ public override void PartialTypeTest ()
+ {
+ string code = GeneratePartialType (Options);
+ Assert.AreEqual (string.Format
(CultureInfo.InvariantCulture,
+ "Public Delegate Sub Test1(){0}", NewLine),
code);
+ }
+#endif
}
[TestFixture]
@@ -2053,6 +2074,17 @@
" End Sub{0}" +
"End Interface{0}", NewLine), code);
}
+
+#if NET_2_0
+ [Test]
+ public override void PartialTypeTest ()
+ {
+ string code = GeneratePartialType (Options);
+ Assert.AreEqual (string.Format
(CultureInfo.InvariantCulture,
+ "Partial Public Interface Test1{0}" +
+ "End Interface{0}", NewLine), code);
+ }
+#endif
}
[TestFixture]
@@ -2852,6 +2884,17 @@
" End Sub{0}" +
"End Structure{0}", NewLine), code);
}
+
+#if NET_2_0
+ [Test]
+ public override void PartialTypeTest ()
+ {
+ string code = GeneratePartialType (Options);
+ Assert.AreEqual (string.Format
(CultureInfo.InvariantCulture,
+ "Partial Public Structure Test1{0}" +
+ "End Structure{0}", NewLine), code);
+ }
+#endif
}
[TestFixture]
@@ -3426,5 +3469,16 @@
" End Sub{0}" +
"End Enum{0}", NewLine), code);
}
+
+#if NET_2_0
+ [Test]
+ public override void PartialTypeTest ()
+ {
+ string code = GeneratePartialType (Options);
+ Assert.AreEqual (string.Format
(CultureInfo.InvariantCulture,
+ "Partial Public Enum Test1{0}" +
+ "End Enum{0}", NewLine), code);
+ }
+#endif
}
}
Modified: trunk/mcs/class/System/Test/System.CodeDom.Compiler/ChangeLog
===================================================================
--- trunk/mcs/class/System/Test/System.CodeDom.Compiler/ChangeLog
2007-12-21 17:56:47 UTC (rev 91779)
+++ trunk/mcs/class/System/Test/System.CodeDom.Compiler/ChangeLog
2007-12-21 18:45:39 UTC (rev 91780)
@@ -1,3 +1,7 @@
+2007-12-21 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
+
+ * CodeGeneratorFromTypeTestBase.cs: Added PartialTypeTest.
+
2007-01-18 Atsushi Enomoto <[EMAIL PROTECTED]>
* CodeGeneratorFromTypeTestBase.cs :
Modified:
trunk/mcs/class/System/Test/System.CodeDom.Compiler/CodeGeneratorFromTypeTestBase.cs
===================================================================
---
trunk/mcs/class/System/Test/System.CodeDom.Compiler/CodeGeneratorFromTypeTestBase.cs
2007-12-21 17:56:47 UTC (rev 91779)
+++
trunk/mcs/class/System/Test/System.CodeDom.Compiler/CodeGeneratorFromTypeTestBase.cs
2007-12-21 18:45:39 UTC (rev 91780)
@@ -179,6 +179,11 @@
[Test]
public abstract void EntryPointMethodTest ();
+
+#if NET_2_0
+ [Test]
+ public abstract void PartialTypeTest ();
+#endif
protected string GenerateDefaultType (CodeGeneratorOptions
options)
{
@@ -1032,6 +1037,13 @@
td.Members.Add (f2);
return GenerateCodeFromType (td, options);
}
+
+ protected string GeneratePartialType (CodeGeneratorOptions
options)
+ {
+ TypeDeclaration.Name = "Test1";
+ TypeDeclaration.IsPartial = true;
+ return GenerateCodeFromType (TypeDeclaration, options);
+ }
#endif
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches