Browse Source

- System.CodeDom review, ns more or less complete now

svn path=/trunk/mcs/; revision=4532
Daniel Stodden 23 years ago
parent
commit
d89628eae5
95 changed files with 3460 additions and 2706 deletions
  1. 167 0
      mcs/class/System/System.CodeDom/ChangeLog
  2. 0 159
      mcs/class/System/System.CodeDom/Code-X-Collection.cs
  3. 46 0
      mcs/class/System/System.CodeDom/CodeArgumentReferenceExpression.cs
  4. 79 30
      mcs/class/System/System.CodeDom/CodeArrayCreateExpression.cs
  5. 56 0
      mcs/class/System/System.CodeDom/CodeArrayIndexerExpression.cs
  6. 7 5
      mcs/class/System/System.CodeDom/CodeAssignStatement.cs
  7. 34 29
      mcs/class/System/System.CodeDom/CodeAttachEventStatement.cs
  8. 14 14
      mcs/class/System/System.CodeDom/CodeAttributeArgument.cs
  9. 47 114
      mcs/class/System/System.CodeDom/CodeAttributeArgumentCollection.cs
  10. 0 42
      mcs/class/System/System.CodeDom/CodeAttributeBlock.cs
  11. 14 12
      mcs/class/System/System.CodeDom/CodeAttributeDeclaration.cs
  12. 46 112
      mcs/class/System/System.CodeDom/CodeAttributeDeclarationCollection.cs
  13. 8 3
      mcs/class/System/System.CodeDom/CodeBaseReferenceExpression.cs
  14. 18 38
      mcs/class/System/System.CodeDom/CodeBinaryOperatorExpression.cs
  15. 17 12
      mcs/class/System/System.CodeDom/CodeBinaryOperatorType.cs
  16. 25 7
      mcs/class/System/System.CodeDom/CodeCastExpression.cs
  17. 51 17
      mcs/class/System/System.CodeDom/CodeCatchClause.cs
  18. 46 114
      mcs/class/System/System.CodeDom/CodeCatchClauseCollection.cs
  19. 0 107
      mcs/class/System/System.CodeDom/CodeClass.cs
  20. 0 165
      mcs/class/System/System.CodeDom/CodeClassCollection.cs
  21. 0 17
      mcs/class/System/System.CodeDom/CodeClassConstructor.cs
  22. 0 52
      mcs/class/System/System.CodeDom/CodeClassDelegate.cs
  23. 0 80
      mcs/class/System/System.CodeDom/CodeClassMember.cs
  24. 0 165
      mcs/class/System/System.CodeDom/CodeClassMemberCollection.cs
  25. 62 0
      mcs/class/System/System.CodeDom/CodeComment.cs
  26. 28 11
      mcs/class/System/System.CodeDom/CodeCommentStatement.cs
  27. 100 0
      mcs/class/System/System.CodeDom/CodeCommentStatementCollection.cs
  28. 60 0
      mcs/class/System/System.CodeDom/CodeCompileUnit.cs
  29. 77 0
      mcs/class/System/System.CodeDom/CodeConditionStatement.cs
  30. 18 17
      mcs/class/System/System.CodeDom/CodeConstructor.cs
  31. 20 15
      mcs/class/System/System.CodeDom/CodeDelegateCreateExpression.cs
  32. 23 19
      mcs/class/System/System.CodeDom/CodeDelegateInvokeExpression.cs
  33. 0 55
      mcs/class/System/System.CodeDom/CodeDelegateInvokeStatement.cs
  34. 0 62
      mcs/class/System/System.CodeDom/CodeDetachEventStatement.cs
  35. 59 0
      mcs/class/System/System.CodeDom/CodeDirectionExpression.cs
  36. 21 0
      mcs/class/System/System.CodeDom/CodeEntryPointMethod.cs
  37. 57 0
      mcs/class/System/System.CodeDom/CodeEventReferenceExpression.cs
  38. 8 23
      mcs/class/System/System.CodeDom/CodeExpression.cs
  39. 50 115
      mcs/class/System/System.CodeDom/CodeExpressionCollection.cs
  40. 46 0
      mcs/class/System/System.CodeDom/CodeExpressionStatement.cs
  41. 11 24
      mcs/class/System/System.CodeDom/CodeFieldReferenceExpression.cs
  42. 0 78
      mcs/class/System/System.CodeDom/CodeForLoopStatement.cs
  43. 42 0
      mcs/class/System/System.CodeDom/CodeGotoStatement.cs
  44. 0 73
      mcs/class/System/System.CodeDom/CodeIfStatement.cs
  45. 30 7
      mcs/class/System/System.CodeDom/CodeIndexerExpression.cs
  46. 81 0
      mcs/class/System/System.CodeDom/CodeIterationStatement.cs
  47. 62 0
      mcs/class/System/System.CodeDom/CodeLabeledStatement.cs
  48. 12 7
      mcs/class/System/System.CodeDom/CodeLinePragma.cs
  49. 0 40
      mcs/class/System/System.CodeDom/CodeLiteralClassMember.cs
  50. 0 40
      mcs/class/System/System.CodeDom/CodeLiteralExpression.cs
  51. 0 48
      mcs/class/System/System.CodeDom/CodeLiteralNamespace.cs
  52. 0 36
      mcs/class/System/System.CodeDom/CodeLiteralStatement.cs
  53. 25 14
      mcs/class/System/System.CodeDom/CodeMemberEvent.cs
  54. 28 10
      mcs/class/System/System.CodeDom/CodeMemberField.cs
  55. 61 31
      mcs/class/System/System.CodeDom/CodeMemberMethod.cs
  56. 49 50
      mcs/class/System/System.CodeDom/CodeMemberProperty.cs
  57. 30 34
      mcs/class/System/System.CodeDom/CodeMethodInvokeExpression.cs
  58. 0 84
      mcs/class/System/System.CodeDom/CodeMethodInvokeStatement.cs
  59. 59 0
      mcs/class/System/System.CodeDom/CodeMethodReferenceExpression.cs
  60. 33 1
      mcs/class/System/System.CodeDom/CodeMethodReturnStatement.cs
  61. 42 46
      mcs/class/System/System.CodeDom/CodeNamespace.cs
  62. 99 0
      mcs/class/System/System.CodeDom/CodeNamespaceCollection.cs
  63. 25 5
      mcs/class/System/System.CodeDom/CodeNamespaceImport.cs
  64. 67 83
      mcs/class/System/System.CodeDom/CodeNamespaceImportCollection.cs
  65. 19 0
      mcs/class/System/System.CodeDom/CodeObject.cs
  66. 34 17
      mcs/class/System/System.CodeDom/CodeObjectCreateExpression.cs
  67. 45 26
      mcs/class/System/System.CodeDom/CodeParameterDeclarationExpression.cs
  68. 48 114
      mcs/class/System/System.CodeDom/CodeParameterDeclarationExpressionCollection.cs
  69. 20 8
      mcs/class/System/System.CodeDom/CodePrimitiveExpression.cs
  70. 17 18
      mcs/class/System/System.CodeDom/CodePropertyReferenceExpression.cs
  71. 21 0
      mcs/class/System/System.CodeDom/CodePropertySetValueReferenceExpression.cs
  72. 68 0
      mcs/class/System/System.CodeDom/CodeRemoveEventStatement.cs
  73. 52 0
      mcs/class/System/System.CodeDom/CodeSnippetCompileUnit.cs
  74. 46 0
      mcs/class/System/System.CodeDom/CodeSnippetExpression.cs
  75. 46 0
      mcs/class/System/System.CodeDom/CodeSnippetStatement.cs
  76. 46 0
      mcs/class/System/System.CodeDom/CodeSnippetTypeMember.cs
  77. 27 1
      mcs/class/System/System.CodeDom/CodeStatement.cs
  78. 48 114
      mcs/class/System/System.CodeDom/CodeStatementCollection.cs
  79. 15 4
      mcs/class/System/System.CodeDom/CodeThisReferenceExpression.cs
  80. 19 5
      mcs/class/System/System.CodeDom/CodeThrowExceptionStatement.cs
  81. 34 32
      mcs/class/System/System.CodeDom/CodeTryCatchFinallyStatement.cs
  82. 21 0
      mcs/class/System/System.CodeDom/CodeTypeConstructor.cs
  83. 91 1
      mcs/class/System/System.CodeDom/CodeTypeDeclaration.cs
  84. 99 0
      mcs/class/System/System.CodeDom/CodeTypeDeclarationCollection.cs
  85. 56 0
      mcs/class/System/System.CodeDom/CodeTypeDelegate.cs
  86. 57 1
      mcs/class/System/System.CodeDom/CodeTypeMember.cs
  87. 99 0
      mcs/class/System/System.CodeDom/CodeTypeMemberCollection.cs
  88. 31 7
      mcs/class/System/System.CodeDom/CodeTypeOfExpression.cs
  89. 76 0
      mcs/class/System/System.CodeDom/CodeTypeReference.cs
  90. 99 0
      mcs/class/System/System.CodeDom/CodeTypeReferenceCollection.cs
  91. 31 7
      mcs/class/System/System.CodeDom/CodeTypeReferenceExpression.cs
  92. 57 12
      mcs/class/System/System.CodeDom/CodeVariableDeclarationStatement.cs
  93. 46 0
      mcs/class/System/System.CodeDom/CodeVariableReferenceExpression.cs
  94. 8 1
      mcs/class/System/System.CodeDom/FieldDirection.cs
  95. 24 16
      mcs/class/System/System.CodeDom/MemberAttributes.cs

+ 167 - 0
mcs/class/System/System.CodeDom/ChangeLog

@@ -1,3 +1,170 @@
+2002-05-11  Daniel Stodden  <[email protected]>
+
+	* CodeAttributeArgumentCollection.cs: inherits CollectionBase
+
+	* CodeAttributeDeclarationCollection.cs: inherits CollectionBase
+
+	* CodeCatchClauseCollection.cs: inherits CollectionBase
+
+	* CodeExpressionCollection.cs: inherits CollectionBase
+
+	* CodeNamespaceImportCollection.cs: not CollectionBase, but
+	matching MS docs
+
+	* CodeParameterDeclarationCollection.cs: inherits CollectionBase
+
+	* CodeStatementCollection.cs: inherits CollectionBase
+
+	* CodeArrayCreateExpression.cs: corrections, completions, whatever
+
+	* CodeAssignStatement.cs: corrections, completions, whatever
+
+	* CodeAttachEventStatement.cs: corrections, completions, whatever
+
+	* CodeAttributeArgument.cs: corrections, completions, whatever
+
+	* CodeAttributeDeclaration.cs: corrections, completions, whatever
+
+	* CodeBaseReferenceExpression.cs: corrections, completions,
+	whatever
+
+	* CodeBinaryOperatorExpression.cs: corrections, completions,
+	whatever
+
+	* CodeCastExpression.cs: corrections, completions, whatever
+
+	* CodeCatchClause.cs: corrections, completions, whatever
+
+	* CodeCommentStatement.cs: corrections, completions, whatever
+
+	* CodeConstructor.cs: corrections, completions, whatever
+
+	* CodeDelegateCreateExpression.cs: corrections, completions,
+	whatever
+
+	* CodeDelegateInvokeExpression.cs: corrections, completions,
+	whatever
+
+	* CodeExpression.cs: corrections, completions, whatever
+
+	* CodeFieldReferenceExpression.cs: corrections, completions,
+	whatever
+
+	* CodeIndexerExpression.cs: corrections, completions, whatever
+
+	* CodeLinePragma.cs: corrections, completions, whatever
+
+	* CodeMemberEvent.cs: corrections, completions, whatever
+
+	* CodeMemberField.cs: corrections, completions, whatever
+
+	* CodeMemberMethod.cs: corrections, completions, whatever
+
+	* CodeMemberProperty.cs: corrections, completions, whatever
+
+	* CodeMethodInvokeExpression.cs: corrections, completions,
+	whatever
+
+	* CodeMethodReturnStatement.cs: corrections, completions, whatever
+
+	* CodeNamespace.cs: corrections, completions, whatever
+
+	* CodeNamespaceImport.cs: corrections, completions, whatever
+
+	* CodeObject.cs: corrections, completions, whatever
+
+	* CodeObjectCreateExpression.cs: corrections, completions,
+	whatever
+
+	* CodeParameterDeclarationExpression.cs: corrections, completions,
+	whatever
+
+	* CodePrimitiveExpression.cs: corrections, completions, whatever
+
+	* CodePropertyReferenceExpression.cs: corrections, completions,
+	whatever
+
+	* CodeStatement.cs: corrections, completions, whatever
+
+	* CodeThisReferenceExpression.cs: corrections, completions,
+	whatever
+
+	* CodeThrowExceptionStatement.cs: corrections, completions,
+	whatever
+
+	* CodeTryCatchFinallyStatement.cs: corrections, completions,
+	whatever
+
+	* CodeTypeDeclaration.cs: corrections, completions, whatever
+
+	* CodeTypeMember.cs: corrections, completions, whatever
+
+	* CodeTypeOfExpression.cs: corrections, completions, whatever
+
+	* CodeTypeReferenceExpression.cs: corrections, completions,
+	whatever
+
+	* CodeVariableDeclarationStatement.cs: corrections, completions,
+	whatever
+
+	* FieldDirection.cs: corrections, completions, whatever
+
+	* CodeArgumentReferenceExpression.cs: added
+
+	* CodeArrayIndexerExpression.cs: added
+
+	* CodeComment.cs: added
+
+	* CodeCommentStatementCollection.cs: added
+
+	* CodeCompileUnit.cs: added
+
+	* CodeConditionStatement.cs: added
+
+	* CodeDirectionExpression.cs: added
+
+	* CodeEntryPointMethod.cs: added
+
+	* CodeEventReferenceExpression.cs: added
+
+	* CodeExpressionStatement.cs: added
+
+	* CodeGotoStatement.cs: added
+
+	* CodeIterationStatement.cs: added
+
+	* CodeLabeledStatement.cs: added
+
+	* CodeMethodReferenceExpression.cs: added
+
+	* CodeNamespaceCollection.cs: added
+
+	* CodePropertySetValueReferenceExpression.cs: added
+
+	* CodeRemoveEventStatement.cs: added
+
+	* CodeSnippetCompileUnit.cs: added
+
+	* CodeSnippetExpression.cs: added
+
+	* CodeSnippetStatement.cs: added
+
+	* CodeSnippetTypeMember.cs: added
+
+	* CodeTypeConstructor.cs: added
+
+	* CodeTypeDeclarationCollection.cs: added
+
+	* CodeTypeDelegate.cs: added
+
+	* CodeTypeMemberCollection.cs: added
+
+	* CodeTypeReference.cs: added
+
+	* CodeTypeReferenceCollection.cs: added
+
+	* CodeVariableReferenceExpression.cs: added
+
 2001-07-15  Sean MacIsaac  <[email protected]>
 
 	* MemberAttributes.cs: Added so rest of classes would compile.

+ 0 - 159
mcs/class/System/System.CodeDom/Code-X-Collection.cs

@@ -1,159 +0,0 @@
-//
-// System.CodeDOM Code@CONTAINEE@Collection Class implementation
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// (C) 2001 Ximian, Inc.
-//
-
-namespace System.CodeDOM {
-
-	using System.Collections;
-	
-	public class Code@CONTAINEE@Collection : IList, ICollection, IEnumerable {
-
-		ArrayList @arrayname@;
-		
-		//
-		// Constructors
-		//
-		public Code@CONTAINEE@Collection ()
-		{
-			@arrayname@ = new ArrayList ();
-		}
-
-		//
-		// Properties
-		//
-		public int Count {
-			get {
-				return @[email protected];
-			}
-		}
-
-		//
-		// Methods
-		//
-		public void Add (Code@CONTAINEE@ value)
-		{
-			@[email protected] (value);
-		}
-
-		public void AddRange (Code@CONTAINEE@ [] values)
-		{
-			foreach (Code@CONTAINEE@ ca in values) 
-				@[email protected] (ca);
-
-		}
-
-		public void Clear ()
-		{
-			@[email protected] ();
-		}
-
-		private class Enumerator : IEnumerator {
-			private Code@CONTAINEE@Collection collection;
-			private int currentIndex = -1;
-
-			internal Enumerator (Code@CONTAINEE@Collection collection)
-			{
-				this.collection = collection;
-			}
-
-			public object Current {
-				get {
-					if (currentIndex == collection.Count)
-						throw new InvalidOperationException ();
-					return collection [currentIndex];
-				}
-			}
-
-			public bool MoveNext ()
-			{
-				if (currentIndex > collection.Count)
-					throw new InvalidOperationException ();
-				return ++currentIndex < collection.Count;
-			}
-
-			public void Reset ()
-			{
-				currentIndex = -1;
-			}
-		}
-		
-		public IEnumerator GetEnumerator ()
-		{
-			return new Code@[email protected] (this);
-		}
-
-		//
-		// IList method implementations
-		//
-		public int Add (object value)
-		{
-			return @[email protected] (value);
-		}
-
-		public bool Contains (Object value)
-		{
-			return @[email protected] (value);
-		}
-
-		public int IndexOf (Object value)
-		{
-			return @[email protected] (value);
-		}
-
-		public void Insert (int index, Object value)
-		{
-			@arrayname@ [index] = value;
-		}
-
-		public object this[int index] {
-			get {
-				return @arrayname@ [index];
-			}
-
-			set {
-				@arrayname@ [index] = value;
-			}
-		}
-
-		public void Remove (object value)
-		{
-			@[email protected] (value);
-		}
-
-		public void RemoveAt (int index)
-		{
-			@[email protected] (index);
-		}
-
-		//
-		// ICollection method implementations
-		//
-		public void CopyTo (Array array, int index)
-		{
-			@[email protected] (array, index);
-		}
-
-		public object SyncRoot {
-			get {
-				return @[email protected];
-			}
-		}
-
-		public bool IsReadOnly {
-			get {
-				return false;
-			}
-		}
-
-		public bool IsSynchronized {
-			get {
-				return @[email protected];
-			}
-		}
-	}
-}

+ 46 - 0
mcs/class/System/System.CodeDom/CodeArgumentReferenceExpression.cs

@@ -0,0 +1,46 @@
+//
+// System.CodeDom CodeArgumentReferenceExpression Class implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom {
+
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeArgumentReferenceExpression 
+		: CodeExpression
+	{
+		private string parameterName;
+
+		//
+		// Constructors
+		//
+		public CodeArgumentReferenceExpression()
+		{
+		}
+
+		public CodeArgumentReferenceExpression( string name )
+		{
+			this.parameterName = name;
+		}
+
+		//
+		// Properties
+		//
+		public string ParameterName {
+			get {
+				return parameterName;
+			}
+			set {
+				parameterName = value;
+			}
+		}
+	}
+}

+ 79 - 30
mcs/class/System/System.CodeDom/CodeArrayCreateExpression.cs

@@ -3,86 +3,135 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
+
+using System.Runtime.InteropServices;
+
 namespace System.CodeDom {
 
 	[Serializable]
-	public class CodeArrayCreateExpression : CodeExpression {
-		string createType;
-		CodeExpressionCollection initializers;
-		CodeExpression sizeExpression;
-		int size;
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeArrayCreateExpression
+		: CodeExpression 
+	{
+		private CodeTypeReference createType;
+		private CodeExpressionCollection initializers;
+		private CodeExpression sizeExpression;
+		private int size;
 		
 		//
 		// Constructors
 		//
 		public CodeArrayCreateExpression ()
 		{
-			
 		}
 
-		public CodeArrayCreateExpression (string createType, CodeExpression size)
+
+		public CodeArrayCreateExpression (CodeTypeReference createType, 
+						  CodeExpression size )
 		{
 			this.createType = createType;
 			this.sizeExpression = size;
 		}
 
-		public CodeArrayCreateExpression (string createType, int size)
+		public CodeArrayCreateExpression (CodeTypeReference createType, 
+						  params CodeExpression[] inializers )
 		{
 			this.createType = createType;
-			this.size = size;
+			this.Initializers.AddRange( initializers );
 		}
 
-		public CodeArrayCreateExpression (string createType, CodeExpression [] initializers)
+		public CodeArrayCreateExpression (CodeTypeReference createType, 
+						  int size)
 		{
 			this.createType = createType;
-			this.initializers = new CodeExpressionCollection ();
+			this.size = size;
+		}
+
+
+		public CodeArrayCreateExpression (string createType, 
+						  CodeExpression size)
+		{
+			this.createType = new CodeTypeReference( createType );
+			this.sizeExpression = size;
+		}
+
+		public CodeArrayCreateExpression (string createType, 
+						  params CodeExpression[] initializers)
+		{
+			this.createType = new CodeTypeReference( createType );
+			this.Initializers.AddRange( initializers );
+		}
 
-			this.initializers.AddRange (initializers);
+		public CodeArrayCreateExpression (string createType, 
+						  int size)
+		{
+			this.createType = new CodeTypeReference( createType );
+			this.size = size;
+		}
+
+
+		public CodeArrayCreateExpression (Type createType, 
+						  CodeExpression size)
+		{
+			this.createType = new CodeTypeReference( createType );
+			this.sizeExpression = size;
+		}
+			
+		public CodeArrayCreateExpression (Type createType, 
+						  params CodeExpression[] initializers)
+		{
+			this.createType = new CodeTypeReference( createType );
+			this.Initializers.AddRange( initializers );
+		}
+
+		public CodeArrayCreateExpression (Type createType, 
+						  int size)
+		{
+			this.createType = new CodeTypeReference( createType );
+			this.size = size;
 		}
 
 		//
 		// Properties
 		//
-		public CodeExpression SizeExpression {
+		public CodeTypeReference CreateType {
 			get {
-				return sizeExpression;
+				return createType;
 			}
-
 			set {
-				sizeExpression = value;
+				createType = value;
 			}
 		}
 
-		public int Size {
+		public CodeExpressionCollection Initializers {
 			get {
-				return size;
-			}
-
-			set {
-				size = value;
+				if ( initializers == null )
+					initializers = new CodeExpressionCollection();
+					
+				return initializers;
 			}
 		}
 
-		public CodeExpressionCollection Initializers {
+		public CodeExpression SizeExpression {
 			get {
-				return initializers;
+				return sizeExpression;
 			}
-
 			set {
-				initializers = value;
+				sizeExpression = value;
 			}
 		}
 
-		public string CreateType {
+		public int Size {
 			get {
-				return createType;
+				return size;
 			}
-
 			set {
-				createType = value;
+				size = value;
 			}
 		}
 	}

+ 56 - 0
mcs/class/System/System.CodeDom/CodeArrayIndexerExpression.cs

@@ -0,0 +1,56 @@
+//
+// System.CodeDom CodeArrayIndexerExpression Class implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom {
+
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeArrayIndexerExpression
+		: CodeExpression 
+	{
+		private CodeExpressionCollection indices;
+		private CodeExpression targetObject;
+
+		//
+		// Constructors
+		//
+		public CodeArrayIndexerExpression()
+		{
+		}
+
+		public CodeArrayIndexerExpression( CodeExpression targetObject, params CodeExpression[] indices )
+		{
+			this.targetObject = targetObject;
+			this.Indices.AddRange( indices );
+		}
+
+		//
+		// Properties
+		//
+		public CodeExpressionCollection Indices {
+			get {
+				if ( indices == null )
+					indices = new CodeExpressionCollection();
+				return indices;
+			}
+		}
+
+		public CodeExpression TargetObject {
+			get {
+				return targetObject;
+			}
+			set {
+				targetObject = value;
+			}
+		}
+	}
+}

+ 7 - 5
mcs/class/System/System.CodeDom/CodeAssignStatement.cs

@@ -7,11 +7,15 @@
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom {
 	[Serializable]
-	public class CodeAssignStatement : CodeStatement {
-
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeAssignStatement
+		: CodeStatement 
+	{
 		CodeExpression left, right;
 
 		//
@@ -34,7 +38,6 @@ namespace System.CodeDom {
 			get {
 				return left;
 			}
-
 			set {
 				left = value;
 			}
@@ -44,7 +47,6 @@ namespace System.CodeDom {
 			get {
 				return right;
 			}
-
 			set {
 				right = value;
 			}

+ 34 - 29
mcs/class/System/System.CodeDom/CodeAttachEventStatement.cs

@@ -3,60 +3,65 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
-namespace System.CodeDom {
 
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom 
+{
 	[Serializable]
-	public class CodeAttachEventStatement : CodeStatement {
-		CodeExpression targetObject;
-		string eventName;
-		CodeExpression newListener;
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeAttachEventStatement
+		: CodeStatement 
+	{
+		private CodeEventReferenceExpression eventRef;
+		private CodeExpression listener;
 		
+		//
+		// Constructors
+		//
 		public CodeAttachEventStatement ()
 		{
 		}
 
-		public CodeAttachEventStatement (CodeExpression targetObject,
-						 string eventName,
-						 CodeExpression newListener)
+		public CodeAttachEventStatement (CodeEventReferenceExpression eventRef,
+						 CodeExpression listener)
 		{
-			this.targetObject = targetObject;
-			this.eventName = eventName;
-			this.newListener = newListener;
+			this.eventRef = eventRef;
+			this.listener = listener;
 		}
 
+		public CodeAttachEventStatement (CodeExpression targetObject,
+						 string eventName, 
+						 CodeExpression listener)
+		{
+			this.eventRef = new CodeEventReferenceExpression( targetObject,
+									  eventName );
+			this.listener = listener;
+		}
+								  
 		//
 		// Properties
 		//
-		public string EventName {
-			get {
-				return eventName;
-			}
-
-			set {
-				eventName = value;
-			}
-		}
-
-		public CodeExpression NewListener {
+		public CodeEventReferenceExpression Event {
 			get {
-				return newListener; 
+				return eventRef;
 			}
-
 			set {
-				newListener = value;
+				eventRef = value;
 			}
 		}
 
-		public CodeExpression TargetObject {
+		public CodeExpression Listener {
 			get {
-				return targetObject;
+				return listener; 
 			}
-
 			set {
-				targetObject = value;
+				listener = value;
 			}
 		}
 	}

+ 14 - 14
mcs/class/System/System.CodeDom/CodeAttributeArgument.cs

@@ -7,12 +7,17 @@
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom
+{
 	[Serializable]
-	public class CodeAttributeArgument {
-		string name;
-		CodeExpression val;
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeAttributeArgument
+	{
+		private string name;
+		private CodeExpression value;
 		
 		//
 		// Constructors
@@ -23,23 +28,22 @@ namespace System.CodeDom {
 
 		public CodeAttributeArgument (CodeExpression value)
 		{
+			this.value = value;
 		}
 
-		public CodeAttributeArgument (string name, CodeExpression val)
+		public CodeAttributeArgument (string name, CodeExpression value)
 		{
 			this.name = name;
-			this.val = val;
+			this.value = value;
 		}
 
 		//
 		// Properties
 		//
-
 		public string Name {
 			get {
 				return name;
 			}
-
 			set {
 				name = value;
 			}
@@ -47,15 +51,11 @@ namespace System.CodeDom {
 
 		public CodeExpression Value {
 			get {
-				return val;
+				return this.value;
 			}
-
 			set {
-				val = value;
+				this.value = value;
 			}
 		}
-
-		
 	}
-
 }

+ 47 - 114
mcs/class/System/System.CodeDom/CodeAttributeArgumentCollection.cs

@@ -3,165 +3,98 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
+using System.Collections;
 
-	using System.Collections;
-	
+namespace System.CodeDom 
+{
 	[Serializable]
-	public class CodeAttributeArgumentCollection : IList, ICollection, IEnumerable {
-
-		ArrayList attributeArgs;
-		
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeAttributeArgumentCollection
+		: CollectionBase
+	{
 		//
 		// Constructors
 		//
-		public CodeAttributeArgumentCollection ()
+		public CodeAttributeArgumentCollection()
+		{
+		}
+
+		public CodeAttributeArgumentCollection( CodeAttributeArgument[] value )
+		{
+			AddRange( value );
+		}
+
+		public CodeAttributeArgumentCollection( CodeAttributeArgumentCollection value )
 		{
-			attributeArgs = new ArrayList ();
+			AddRange( value );
 		}
 
 		//
 		// Properties
 		//
-		public int Count {
+		public CodeAttributeArgument this[int index]
+		{
 			get {
-				return attributeArgs.Count;
+				return (CodeAttributeArgument)List[index];
 			}
-		}
-
-		public bool IsFixedSize {
-			get {	
-				return true;
+			set {
+				List[index] = value;
 			}
 		}
 
 		//
 		// Methods
 		//
-
 		public void Add (CodeAttributeArgument value)
 		{
-			attributeArgs.Add (value);
+			List.Add( value );
 		}
 
-		public void AddRange (CodeAttributeArgument [] values)
+		public void AddRange (CodeAttributeArgument [] value )
 		{
-			foreach (CodeAttributeArgument ca in values) 
-				attributeArgs.Add (ca);
-
-		}
-
-		public void Clear ()
-		{
-			attributeArgs.Clear ();
-		}
-
-		private class Enumerator : IEnumerator {
-			private CodeAttributeArgumentCollection collection;
-			private int currentIndex = -1;
-
-			internal Enumerator (CodeAttributeArgumentCollection collection)
-			{
-				this.collection = collection;
-			}
-
-			public object Current {
-				get {
-					if (currentIndex == collection.Count)
-						throw new InvalidOperationException ();
-					return collection [currentIndex];
-				}
-			}
-
-			public bool MoveNext ()
-			{
-				if (currentIndex > collection.Count)
-					throw new InvalidOperationException ();
-				return ++currentIndex < collection.Count;
-			}
-
-			public void Reset ()
-			{
-				currentIndex = -1;
-			}
+			foreach ( CodeAttributeArgument elem in value )
+				Add( elem );
 		}
 		
-		public IEnumerator GetEnumerator ()
-		{
-			return new CodeAttributeArgumentCollection.Enumerator (this);
-		}
-
-		//
-		// IList method implementations
-		//
-		public int Add (object value)
+		public void AddRange (CodeAttributeArgumentCollection value)
 		{
-			return attributeArgs.Add (value);
+			foreach ( CodeAttributeArgument elem in value )
+				Add( elem );
 		}
 
-		public bool Contains (Object value)
+		public bool Contains( CodeAttributeArgument value )
 		{
-			return attributeArgs.Contains (value);
+			return List.Contains( value );
 		}
-
-		public int IndexOf (Object value)
+		
+		public void CopyTo( CodeAttributeArgument[] array, int index )
 		{
-			return attributeArgs.IndexOf (value);
+			List.CopyTo( array, index );
 		}
 
-		public void Insert (int index, Object value)
+		public int IndexOf( CodeAttributeArgument value )
 		{
-			attributeArgs [index] = value;
+			return List.IndexOf( value );
 		}
 
-		public object this[int index] {
-			get {
-				return attributeArgs [index];
-			}
-
-			set {
-				attributeArgs [index] = value;
-			}
-		}
-
-		public void Remove (object value)
+		public void Insert( int index, CodeAttributeArgument value )
 		{
-			attributeArgs.Remove (value);
+			List.Insert( index, value );
 		}
 
-		public void RemoveAt (int index)
+		public void Remove( CodeAttributeArgument value )
 		{
-			attributeArgs.RemoveAt (index);
-		}
-
-		//
-		// ICollection method implementations
-		//
-		public void CopyTo (Array array, int index)
-		{
-			attributeArgs.CopyTo (array, index);
-		}
-
-		public object SyncRoot {
-			get {
-				return attributeArgs.SyncRoot;
-			}
-		}
-
-		public bool IsReadOnly {
-			get {
-				return false;
-			}
-		}
-
-		public bool IsSynchronized {
-			get {
-				return attributeArgs.IsSynchronized;
-			}
+			int index = IndexOf( value );
+			if ( index < 0 )
+				throw( new ArgumentException( "The specified object is not found in the collection" ) );
+			RemoveAt( index );
 		}
 	}
 }

+ 0 - 42
mcs/class/System/System.CodeDom/CodeAttributeBlock.cs

@@ -1,42 +0,0 @@
-//
-// System.CodeDom CodeAttributeBlock Class implementation
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// (C) 2001 Ximian, Inc.
-//
-
-namespace System.CodeDom {
-
-	public class CodeAttributeBlock {
-
-		CodeAttributeDeclarationCollection attributes;
-		
-		//
-		// Constructors
-		//
-		public CodeAttributeBlock ()
-		{
-		}
-		
-		public CodeAttributeBlock (CodeAttributeDeclaration [] attributes)
-		{
-			this.attributes = new CodeAttributeDeclarationCollection ();
-			this.attributes.AddRange (attributes);
-		}
-
-		//
-		// Prpoperties
-		//
-		public CodeAttributeDeclarationCollection Attributes {
-			get {
-				return attributes;
-			}
-
-			set {
-				attributes = value;
-			}
-		}
-	}
-}

+ 14 - 12
mcs/class/System/System.CodeDom/CodeAttributeDeclaration.cs

@@ -3,17 +3,22 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom 
+{
 	[Serializable]
-	public class CodeAttributeDeclaration {
-
-		string name;
-		CodeAttributeArgumentCollection arguments;
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeAttributeDeclaration 
+	{
+		private string name;
+		private CodeAttributeArgumentCollection arguments;
 		
 		//
 		// Constructors
@@ -30,8 +35,7 @@ namespace System.CodeDom {
 		public CodeAttributeDeclaration (string name, CodeAttributeArgument [] arguments)
 		{
 			this.name = name;
-			this.arguments = new CodeAttributeArgumentCollection ();
-			this.arguments.AddRange (arguments);
+			Arguments.AddRange (arguments);
 		}
 
 		//
@@ -39,11 +43,10 @@ namespace System.CodeDom {
 		//
 		public CodeAttributeArgumentCollection Arguments {
 			get {
-				return arguments;
-			}
+				if ( arguments == null )
+					arguments = new CodeAttributeArgumentCollection();
 
-			set {
-				arguments = value;
+				return arguments;
 			}
 		}
 
@@ -51,7 +54,6 @@ namespace System.CodeDom {
 			get {
 				return name;
 			}
-
 			set {
 				name = value;
 			}

+ 46 - 112
mcs/class/System/System.CodeDom/CodeAttributeDeclarationCollection.cs

@@ -3,164 +3,98 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
+using System.Collections;
 
-	using System.Collections;
-	
+namespace System.CodeDom 
+{
 	[Serializable]
-	public class CodeAttributeDeclarationCollection : IList, ICollection, IEnumerable {
-
-		ArrayList attributeDecls;
-		
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeAttributeDeclarationCollection 
+		: CollectionBase
+	{
 		//
 		// Constructors
 		//
-		public CodeAttributeDeclarationCollection ()
+		public CodeAttributeDeclarationCollection()
 		{
-			attributeDecls = new ArrayList ();
 		}
 
-		//
-		// Properties
-		//
-		public int Count {
-			get {
-				return attributeDecls.Count;
-			}
-		}
-
-                public bool IsFixedSize {
-                        get {
-                                return true;
-                        }
-                }
-
-		//
-		// Methods
-		//
-		public void Add (CodeAttributeDeclaration value)
+		public CodeAttributeDeclarationCollection( CodeAttributeDeclaration[] value )
 		{
-			attributeDecls.Add (value);
+			AddRange( value );
 		}
 
-		public void AddRange (CodeAttributeDeclaration [] values)
+		public CodeAttributeDeclarationCollection( CodeAttributeDeclarationCollection value )
 		{
-			foreach (CodeAttributeDeclaration ca in values) 
-				attributeDecls.Add (ca);
-
+			AddRange( value );
 		}
 
-		public void Clear ()
+		//
+		// Properties
+		//
+		public CodeAttributeDeclaration this[int index]
 		{
-			attributeDecls.Clear ();
-		}
-
-		private class Enumerator : IEnumerator {
-			private CodeAttributeDeclarationCollection collection;
-			private int currentIndex = -1;
-
-			internal Enumerator (CodeAttributeDeclarationCollection collection)
-			{
-				this.collection = collection;
-			}
-
-			public object Current {
-				get {
-					if (currentIndex == collection.Count)
-						throw new InvalidOperationException ();
-					return collection [currentIndex];
-				}
-			}
-
-			public bool MoveNext ()
-			{
-				if (currentIndex > collection.Count)
-					throw new InvalidOperationException ();
-				return ++currentIndex < collection.Count;
+			get {
+				return (CodeAttributeDeclaration)List[index];
 			}
-
-			public void Reset ()
-			{
-				currentIndex = -1;
+			set {
+				List[index] = value;
 			}
 		}
-		
-		public IEnumerator GetEnumerator ()
-		{
-			return new CodeAttributeDeclarationCollection.Enumerator (this);
-		}
 
 		//
-		// IList method implementations
+		// Methods
 		//
-		public int Add (object value)
+		public void Add (CodeAttributeDeclaration value)
 		{
-			return attributeDecls.Add (value);
+			List.Add (value);
 		}
 
-		public bool Contains (Object value)
+		public void AddRange (CodeAttributeDeclaration [] value)
 		{
-			return attributeDecls.Contains (value);
+			foreach (CodeAttributeDeclaration elem in value) 
+				Add( elem );
 		}
 
-		public int IndexOf (Object value)
+		public void AddRange (CodeAttributeDeclarationCollection value)
 		{
-			return attributeDecls.IndexOf (value);
+			foreach (CodeAttributeDeclaration elem in value) 
+				Add( elem );
 		}
 
-		public void Insert (int index, Object value)
+		public bool Contains( CodeAttributeDeclaration value )
 		{
-			attributeDecls [index] = value;
+			return List.Contains( value );
 		}
 
-		public object this[int index] {
-			get {
-				return attributeDecls [index];
-			}
-
-			set {
-				attributeDecls [index] = value;
-			}
-		}
-
-		public void Remove (object value)
+		public void CopyTo( CodeAttributeDeclaration[] array, int index )
 		{
-			attributeDecls.Remove (value);
+			List.CopyTo( array, index );
 		}
 
-		public void RemoveAt (int index)
+		public int IndexOf( CodeAttributeDeclaration value )
 		{
-			attributeDecls.RemoveAt (index);
+			return List.IndexOf( value );
 		}
 
-		//
-		// ICollection method implementations
-		//
-		public void CopyTo (Array array, int index)
+		public void Insert( int index, CodeAttributeDeclaration value )
 		{
-			attributeDecls.CopyTo (array, index);
-		}
-
-		public object SyncRoot {
-			get {
-				return attributeDecls.SyncRoot;
-			}
-		}
-
-		public bool IsReadOnly {
-			get {
-				return false;
-			}
+			List.Insert( index, value );
 		}
 
-		public bool IsSynchronized {
-			get {
-				return attributeDecls.IsSynchronized;
-			}
+		public void Remove( CodeAttributeDeclaration value )
+		{
+			int index = IndexOf( value );
+			if ( index < 0 )
+				throw( new ArgumentException( "The specified object is not found in the collection" ) );
+			RemoveAt( index );
 		}
 	}
 }

+ 8 - 3
mcs/class/System/System.CodeDom/CodeBaseReferenceExpression.cs

@@ -7,10 +7,15 @@
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom 
+{
 	[Serializable]
-	public class CodeBaseReferenceExpression : CodeExpression {
-		public CodeBaseReferenceExpression () {}
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeBaseReferenceExpression
+		: CodeExpression 
+	{
 	}
 }

+ 18 - 38
mcs/class/System/System.CodeDom/CodeBinaryOperatorExpression.cs

@@ -7,34 +7,19 @@
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom
+{
 	[Serializable]
-	public class CodeBinaryOperatorExpression : CodeExpression {
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeBinaryOperatorExpression
+		: CodeExpression 
+	{
+		private CodeExpression left, right;
+		private CodeBinaryOperatorType op;
 
-		CodeExpression left, right;
-		CodeBinaryOperatorType oper;
-
-		public enum CodeBinaryOperatorType {
-			Add,
-			Substract,
-			Multiply,
-			Divide,
-			Modulus,
-			Assign,
-			IdentityInequality,
-			IdentityEquality,
-			ValueEquality,
-			BitwiseOr,
-			BitwiseAnd,
-			BooleanOr,
-			BooleanAnd,
-			LessThan,
-			LessThanOrEqual,
-			GreatherThan,
-			GreatherThanOrEqual,
-		}
-		
 		//
 		// Constructors
 		//
@@ -42,13 +27,12 @@ namespace System.CodeDom {
 		{
 		}
 
-
 		public CodeBinaryOperatorExpression (CodeExpression left,
-						     CodeBinaryOperatorType oper,
+						     CodeBinaryOperatorType op,
 						     CodeExpression right)
 		{
 			this.left = left;
-			this.oper = oper;
+			this.op = op;
 			this.right = right;
 		}
 
@@ -59,31 +43,27 @@ namespace System.CodeDom {
 			get {
 				return left;
 			}
-
 			set {
 				left = value;
 			}
 		}
 
-		public CodeExpression Right {
+		public CodeBinaryOperatorType Operator {
 			get {
-				return right;
+				return op;
 			}
-
 			set {
-				right = value;
+				op = value;
 			}
 		}
 
-		public CodeBinaryOperatorType Operator {
+		public CodeExpression Right {
 			get {
-				return oper;
+				return right;
 			}
-
 			set {
-				oper = value;
+				right = value;
 			}
 		}
 	}
 }
-

+ 17 - 12
mcs/class/System/System.CodeDom/CodeBinaryOperatorType.cs

@@ -7,24 +7,29 @@
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom 
+{
+	[Serializable]
+	[ComVisible(true)]
 	public enum CodeBinaryOperatorType {
 		Add,
-		Subtract,
-		Multiply,
-		Divide,
-		Modulus,
 		Assign,
-		IdentityInequality,
-		IdentityEquality,
-		ValueEquality,
-		BitwiseOr,
 		BitwiseAnd,
-		BooleanOr,
+		BitwiseOr,
 		BooleanAnd,
-		LessThan,
-		LessThanOrEqual,
+		BooleanOr,
+		Divide,
 		GreaterThan,
 		GreaterThanOrEqual,
+		IdentityEquality,
+		IdentityInequality,
+		LessThan,
+		LessThanOrEqual,
+		Modulus,
+		Multiply,
+		Subtract,
+		ValueEquality
 	}
 }

+ 25 - 7
mcs/class/System/System.CodeDom/CodeCastExpression.cs

@@ -3,16 +3,23 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom 
+{
 	[Serializable]
-	public class CodeCastExpression : CodeExpression {
-		string targetType;
-		CodeExpression expression;
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeCastExpression
+		: CodeExpression 
+	{
+		private CodeTypeReference targetType;
+		private CodeExpression expression;
 		
 		//
 		// Constructors
@@ -21,12 +28,24 @@ namespace System.CodeDom {
 		{
 		}
 
-		public CodeCastExpression (string targetType, CodeExpression expression)
+		public CodeCastExpression (CodeTypeReference targetType, CodeExpression expression)
 		{
 			this.targetType = targetType;
 			this.expression = expression;
 		}
 
+		public CodeCastExpression (string targetType, CodeExpression expression)
+		{
+			this.targetType = new CodeTypeReference( targetType );
+			this.expression = expression;
+		}
+
+		public CodeCastExpression (Type targetType, CodeExpression expression)
+		{
+			this.targetType = new CodeTypeReference( targetType );
+			this.expression = expression;
+		}
+
 		//
 		// Properties
 		//
@@ -40,11 +59,10 @@ namespace System.CodeDom {
 			}
 		}
 
-		public string TargetType {
+		public CodeTypeReference TargetType {
 			get {
 				return targetType;
 			}
-
 			set {
 				targetType = value;
 			}

+ 51 - 17
mcs/class/System/System.CodeDom/CodeCatchClause.cs

@@ -3,44 +3,78 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom
+{
 	[Serializable]
-	public class CodeCatchClause {
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeCatchClause
+	{
+		private CodeTypeReference catchExceptionType;
+		private string localName;
+		private CodeStatementCollection statements;
 
-		CodeParameterDeclarationExpression condition;
-		CodeStatementCollection statements;
-		
+		//
+		// Constructors
+		//
 		public CodeCatchClause ()
 		{
-			this.statements = new CodeStatementCollection ();
 		}
 
-		public CodeCatchClause (CodeParameterDeclarationExpression condition,
-					CodeStatement [] statements)
+		public CodeCatchClause ( string localName )
 		{
-			this.condition = condition;
-			this.statements = new CodeStatementCollection ();
-			this.statements.AddRange (statements);
+			this.localName = localName;
 		}
 
-		public CodeStatementCollection Statements {
+		public CodeCatchClause ( string localName,
+					 CodeTypeReference catchExceptionType )
+		{
+			this.localName = localName;
+			this.catchExceptionType = catchExceptionType;
+		}
+
+		public CodeCatchClause ( string localName,
+					 CodeTypeReference catchExceptionType,
+					 CodeStatement[] statements )
+		{
+			this.localName = localName;
+			this.catchExceptionType = catchExceptionType;
+			this.Statements.AddRange( statements );
+		}
+
+		//
+		// Properties
+		//
+		public CodeTypeReference CatchExceptionType {
 			get {
-				return statements;
+				return catchExceptionType;
+			}
+			set {
+				catchExceptionType = value;
 			}
 		}
 
-		public CodeParameterDeclarationExpression Condition {
+		public string LocalName {
 			get {
-				return condition;
+				return localName;
 			}
-
 			set {
-				condition = value;
+				localName = value;
+			}
+		}
+
+		public CodeStatementCollection Statements {
+			get {
+				if ( statements == null )
+					statements = new CodeStatementCollection();
+				return statements;
 			}
 		}
 	}

+ 46 - 114
mcs/class/System/System.CodeDom/CodeCatchClauseCollection.cs

@@ -7,36 +7,44 @@
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
+using System.Collections;
 
-	using System.Collections;
-	
+namespace System.CodeDom 
+{
 	[Serializable]
-	public class CodeCatchClauseCollection : IList, ICollection, IEnumerable {
-
-		ArrayList catchClauses;
-		
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeCatchClauseCollection
+		: CollectionBase
+	{
 		//
 		// Constructors
 		//
-		public CodeCatchClauseCollection ()
+		public CodeCatchClauseCollection()
+		{
+		}
+
+		public CodeCatchClauseCollection( CodeCatchClause[] value )
+		{
+			AddRange( value );
+		}
+
+		public CodeCatchClauseCollection( CodeCatchClauseCollection value )
 		{
-			catchClauses = new ArrayList ();
+			AddRange( value );
 		}
 
 		//
 		// Properties
 		//
-		public int Count {
-			get {
-				return catchClauses.Count;
-			}
-		}
-
-                public bool IsFixedSize {
+                public CodeCatchClause this[int index] {
                         get {
-                                return true;
+                                return (CodeCatchClause)List[index];
                         }
+			set {
+				List[index] = value;
+			}
                 }
 
 		//
@@ -44,123 +52,47 @@ namespace System.CodeDom {
 		//
 		public void Add (CodeCatchClause value)
 		{
-			catchClauses.Add (value);
-		}
-
-		public void AddRange (CodeCatchClause [] values)
-		{
-			foreach (CodeCatchClause ca in values) 
-				catchClauses.Add (ca);
-
-		}
-
-		public void Clear ()
-		{
-			catchClauses.Clear ();
-		}
-
-		private class Enumerator : IEnumerator {
-			private CodeCatchClauseCollection collection;
-			private int currentIndex = -1;
-
-			internal Enumerator (CodeCatchClauseCollection collection)
-			{
-				this.collection = collection;
-			}
-
-			public object Current {
-				get {
-					if (currentIndex == collection.Count)
-						throw new InvalidOperationException ();
-					return collection [currentIndex];
-				}
-			}
-
-			public bool MoveNext ()
-			{
-				if (currentIndex > collection.Count)
-					throw new InvalidOperationException ();
-				return ++currentIndex < collection.Count;
-			}
-
-			public void Reset ()
-			{
-				currentIndex = -1;
-			}
-		}
-		
-		public IEnumerator GetEnumerator ()
-		{
-			return new CodeCatchClauseCollection.Enumerator (this);
+			List.Add (value);
 		}
 
-		//
-		// IList method implementations
-		//
-		public int Add (object value)
+		public void AddRange (CodeCatchClause [] value)
 		{
-			return catchClauses.Add (value);
+			foreach (CodeCatchClause ca in value) 
+				Add (ca);
 		}
 
-		public bool Contains (Object value)
+		public void AddRange (CodeCatchClauseCollection value )
 		{
-			return catchClauses.Contains (value);
+			foreach (CodeCatchClause ca in value)
+				Add (ca);
 		}
 
-		public int IndexOf (Object value)
+		public bool Contains( CodeCatchClause value )
 		{
-			return catchClauses.IndexOf (value);
+			return List.Contains( value );
 		}
-
-		public void Insert (int index, Object value)
+		
+		public void CopyTo( CodeCatchClause[] array, int index )
 		{
-			catchClauses [index] = value;
+			List.CopyTo( array, index );
 		}
 
-		public object this[int index] {
-			get {
-				return catchClauses [index];
-			}
-
-			set {
-				catchClauses [index] = value;
-			}
-		}
-
-		public void Remove (object value)
+		public int IndexOf( CodeCatchClause value )
 		{
-			catchClauses.Remove (value);
+			return List.IndexOf( value );
 		}
 
-		public void RemoveAt (int index)
+		public void Insert( int index, CodeCatchClause value )
 		{
-			catchClauses.RemoveAt (index);
+			List.Insert( index, value );
 		}
 
-		//
-		// ICollection method implementations
-		//
-		public void CopyTo (Array array, int index)
+		public void Remove( CodeCatchClause value )
 		{
-			catchClauses.CopyTo (array, index);
-		}
-
-		public object SyncRoot {
-			get {
-				return catchClauses.SyncRoot;
-			}
-		}
-
-		public bool IsReadOnly {
-			get {
-				return false;
-			}
-		}
-
-		public bool IsSynchronized {
-			get {
-				return catchClauses.IsSynchronized;
-			}
+			int index = IndexOf( value );
+			if ( index < 0 )
+				throw( new ArgumentException( "The specified object is not found in the collection" ) );
+			RemoveAt( index );
 		}
 	}
 }

+ 0 - 107
mcs/class/System/System.CodeDom/CodeClass.cs

@@ -1,107 +0,0 @@
-//
-// System.CodeDom CodeClass Class implementation
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// (C) 2001 Ximian, Inc.
-//
-
-using System.Collections.Specialized;
-
-namespace System.CodeDom {
-	using System.Reflection;
-	using System.Collections;
-	
-	public class CodeClass : CodeClassMember {
-		CodeClassMemberCollection members;		
-		TypeAttributes attrs;
-		StringCollection baseTypes;
-		bool isClass, isEnum, isInterface, isStruct;
-			
-		string name;
-		
-		//
-		// Constructors
-		//
-		public CodeClass ()
-		{
-		}
-		
-		public CodeClass (string name)
-		{
-			this.name = name;
-		}
-
-		//
-		// Properties
-		//
-		public TypeAttributes attributes {
-			get {
-				return attrs;
-			}
-
-			set {
-				attrs = value;
-			}
-		}
-
-		public StringCollection BaseTypes {
-			get {
-				return baseTypes;
-			}
-
-			set {
-				baseTypes = value;
-			}
-		}
-
-		public bool IsClass {
-			get {
-				return isClass;
-			}
-
-			set {
-				isClass = value;
-			}
-		}
-		public bool IsEnum {
-			get {
-				return isEnum;
-			}
-
-			set {
-				isEnum = value;
-			}
-		}
-		
-		public bool IsInterface {
-			get {
-				return isInterface;
-			}
-
-			set {
-				isInterface = value;
-			}
-		}
-		public bool IsStruct {
-			get {
-				return isStruct;
-			}
-
-			set {
-				isStruct = value;
-			}
-		}
-
-		public CodeClassMemberCollection Members {
-			get {
-				return members;
-			}
-
-			set {
-				members = value;
-			}
-		}
-	}
-}

+ 0 - 165
mcs/class/System/System.CodeDom/CodeClassCollection.cs

@@ -1,165 +0,0 @@
-//
-// System.CodeDom CodeClassCollection Class implementation
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// (C) 2001 Ximian, Inc.
-//
-
-namespace System.CodeDom {
-
-	using System.Collections;
-	
-	public class CodeClassCollection : IList, ICollection, IEnumerable {
-
-		ArrayList classes;
-		
-		//
-		// Constructors
-		//
-		public CodeClassCollection ()
-		{
-			classes = new ArrayList ();
-		}
-
-		//
-		// Properties
-		//
-		public int Count {
-			get {
-				return classes.Count;
-			}
-		}
-
-                public bool IsFixedSize {
-                        get {
-                                return true;
-                        }
-                }
-
-		//
-		// Methods
-		//
-		public void Add (CodeClass value)
-		{
-			classes.Add (value);
-		}
-
-		public void AddRange (CodeClass [] values)
-		{
-			foreach (CodeClass ca in values) 
-				classes.Add (ca);
-
-		}
-
-		public void Clear ()
-		{
-			classes.Clear ();
-		}
-
-		private class Enumerator : IEnumerator {
-			private CodeClassCollection collection;
-			private int currentIndex = -1;
-
-			internal Enumerator (CodeClassCollection collection)
-			{
-				this.collection = collection;
-			}
-
-			public object Current {
-				get {
-					if (currentIndex == collection.Count)
-						throw new InvalidOperationException ();
-					return collection [currentIndex];
-				}
-			}
-
-			public bool MoveNext ()
-			{
-				if (currentIndex > collection.Count)
-					throw new InvalidOperationException ();
-				return ++currentIndex < collection.Count;
-			}
-
-			public void Reset ()
-			{
-				currentIndex = -1;
-			}
-		}
-		
-		public IEnumerator GetEnumerator ()
-		{
-			return new CodeClassCollection.Enumerator (this);
-		}
-
-		//
-		// IList method implementations
-		//
-		public int Add (object value)
-		{
-			return classes.Add (value);
-		}
-
-		public bool Contains (Object value)
-		{
-			return classes.Contains (value);
-		}
-
-		public int IndexOf (Object value)
-		{
-			return classes.IndexOf (value);
-		}
-
-		public void Insert (int index, Object value)
-		{
-			classes [index] = value;
-		}
-
-		public object this[int index] {
-			get {
-				return classes [index];
-			}
-
-			set {
-				classes [index] = value;
-			}
-		}
-
-		public void Remove (object value)
-		{
-			classes.Remove (value);
-		}
-
-		public void RemoveAt (int index)
-		{
-			classes.RemoveAt (index);
-		}
-
-		//
-		// ICollection method implementations
-		//
-		public void CopyTo (Array array, int index)
-		{
-			classes.CopyTo (array, index);
-		}
-
-		public object SyncRoot {
-			get {
-				return classes.SyncRoot;
-			}
-		}
-
-		public bool IsReadOnly {
-			get {
-				return false;
-			}
-		}
-
-		public bool IsSynchronized {
-			get {
-				return classes.IsSynchronized;
-			}
-		}
-	}
-}

+ 0 - 17
mcs/class/System/System.CodeDom/CodeClassConstructor.cs

@@ -1,17 +0,0 @@
-//
-// System.CodeDom CodeClassConstructor Class implementation
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// (C) 2001 Ximian, Inc.
-//
-
-namespace System.CodeDom {
-	public class CodeClassConstructor : CodeMemberMethod {
-
-		public CodeClassConstructor ()
-		{
-		}
-	}
-}

+ 0 - 52
mcs/class/System/System.CodeDom/CodeClassDelegate.cs

@@ -1,52 +0,0 @@
-//
-// System.CodeDom CodeClassDelegate Class implementation
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// (C) 2001 Ximian, Inc.
-//
-
-namespace System.CodeDom {
-
-	public class CodeClassDelegate : CodeClass {
-		CodeParameterDeclarationExpressionCollection parameters;
-		string returnType;
-		string name;
-
-		//
-		// Constructors
-		//
-		public CodeClassDelegate ()
-		{
-		}
-
-		public CodeClassDelegate (string name)
-		{
-			this.name = name;
-		}
-
-		//
-		// Properties
-		//
-		public CodeParameterDeclarationExpressionCollection Parameters {
-			get {
-				return parameters;
-			}
-
-			set {
-				parameters = value;
-			}
-		}
-
-		public string ReturnType {
-			get {
-				return returnType;
-			}
-
-			set {
-				returnType = value;
-			}
-		}
-	}
-}

+ 0 - 80
mcs/class/System/System.CodeDom/CodeClassMember.cs

@@ -1,80 +0,0 @@
-//
-// System.CodeDom CodeClassMember Class implementation
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// (C) 2001 Ximian, Inc.
-//
-
-namespace System.CodeDom {
-
-	public class CodeClassMember : CodeStatement {
-		MemberAttributes attributes;
-		CodeAttributeBlock customAttributes;
-		
-		string name;
-
-		//
-		// Yeah, this is a strange way of defining this
-		//
-		public enum MemberAttributes {
-			Abstract    = 0x0001,
-			Final       = 0x0002,
-			Override    = 0x0004,
-			Const       = 0x0005,
-			Assembly    = 0x1000,
-			AccessMask  = 0xf000,
-			FamANDAssem = 0x2000,
-			Family      = 0x3000,
-			FamORAssem  = 0x4000,
-			New         = 0x0010,
-			Private     = 0x5000,
-			Public      = 0x6000,
-			ScopeMask   = 0x000f,
-			Static      = 0x0003,
-			VTableMask  = 0x00f0
-		}
-		
-		//
-		// Constructors
-		//
-		public CodeClassMember ()
-		{
-		}
-
-		//
-		// Properties
-		//
-
-		public MemberAttributes Attributes {
-			get {
-				return attributes;
-			}
-
-			set {
-				attributes = value;
-			}
-		}
-
-		public CodeAttributeBlock CustomAttributes {
-			get {
-				return customAttributes;
-			}
-
-			set {
-				customAttributes = value;
-			}
-		}
-
-		public string Name {
-			get {
-				return name;
-			}
-
-			set {
-				name = value;
-			}
-		}
-	}
-}

+ 0 - 165
mcs/class/System/System.CodeDom/CodeClassMemberCollection.cs

@@ -1,165 +0,0 @@
-//
-// System.CodeDom CodeClassMemberCollection Class implementation
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// (C) 2001 Ximian, Inc.
-//
-
-namespace System.CodeDom {
-
-	using System.Collections;
-	
-	public class CodeClassMemberCollection : IList, ICollection, IEnumerable {
-
-		ArrayList classMembers;
-		
-		//
-		// Constructors
-		//
-		public CodeClassMemberCollection ()
-		{
-			classMembers = new ArrayList ();
-		}
-
-		//
-		// Properties
-		//
-		public int Count {
-			get {
-				return classMembers.Count;
-			}
-		}
-
-                public bool IsFixedSize {
-                        get {
-                                return true;
-                        }
-                }
-
-		//
-		// Methods
-		//
-		public void Add (CodeClassMember value)
-		{
-			classMembers.Add (value);
-		}
-
-		public void AddRange (CodeClassMember [] values)
-		{
-			foreach (CodeClassMember ca in values) 
-				classMembers.Add (ca);
-
-		}
-
-		public void Clear ()
-		{
-			classMembers.Clear ();
-		}
-
-		private class Enumerator : IEnumerator {
-			private CodeClassMemberCollection collection;
-			private int currentIndex = -1;
-
-			internal Enumerator (CodeClassMemberCollection collection)
-			{
-				this.collection = collection;
-			}
-
-			public object Current {
-				get {
-					if (currentIndex == collection.Count)
-						throw new InvalidOperationException ();
-					return collection [currentIndex];
-				}
-			}
-
-			public bool MoveNext ()
-			{
-				if (currentIndex > collection.Count)
-					throw new InvalidOperationException ();
-				return ++currentIndex < collection.Count;
-			}
-
-			public void Reset ()
-			{
-				currentIndex = -1;
-			}
-		}
-		
-		public IEnumerator GetEnumerator ()
-		{
-			return new CodeClassMemberCollection.Enumerator (this);
-		}
-
-		//
-		// IList method implementations
-		//
-		public int Add (object value)
-		{
-			return classMembers.Add (value);
-		}
-
-		public bool Contains (Object value)
-		{
-			return classMembers.Contains (value);
-		}
-
-		public int IndexOf (Object value)
-		{
-			return classMembers.IndexOf (value);
-		}
-
-		public void Insert (int index, Object value)
-		{
-			classMembers [index] = value;
-		}
-
-		public object this[int index] {
-			get {
-				return classMembers [index];
-			}
-
-			set {
-				classMembers [index] = value;
-			}
-		}
-
-		public void Remove (object value)
-		{
-			classMembers.Remove (value);
-		}
-
-		public void RemoveAt (int index)
-		{
-			classMembers.RemoveAt (index);
-		}
-
-		//
-		// ICollection method implementations
-		//
-		public void CopyTo (Array array, int index)
-		{
-			classMembers.CopyTo (array, index);
-		}
-
-		public object SyncRoot {
-			get {
-				return classMembers.SyncRoot;
-			}
-		}
-
-		public bool IsReadOnly {
-			get {
-				return false;
-			}
-		}
-
-		public bool IsSynchronized {
-			get {
-				return classMembers.IsSynchronized;
-			}
-		}
-	}
-}

+ 62 - 0
mcs/class/System/System.CodeDom/CodeComment.cs

@@ -0,0 +1,62 @@
+//
+// System.CodeDom CodeComment Class implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeComment
+		: CodeObject
+	{
+		private bool docComment;
+		private string text;
+		
+		//
+		// Constructors
+		//
+		public CodeComment()
+		{
+		}
+
+		public CodeComment( string text )
+		{
+			this.text = text;
+		}
+
+		public CodeComment( string text, bool docComment )
+		{
+			this.text = text;
+			this.docComment = docComment;
+		}
+
+		//
+		// Properties
+		//
+		public bool DocComment {
+			get {
+				return docComment;
+			}
+			set {
+				docComment = value;
+			}
+		}
+		
+		public string Text {
+			get {
+				return text;
+			}
+			set {
+				text = value;
+			}
+		}
+	}
+}

+ 28 - 11
mcs/class/System/System.CodeDom/CodeCommentStatement.cs

@@ -3,15 +3,22 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
-// (C) 2001 Ximian, Inc.
+// (C) 2001, 2002 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom
+{
 	[Serializable]
-	public class CodeCommentStatement : CodeStatement {
-		string text;
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeCommentStatement
+		: CodeStatement
+	{
+		private CodeComment comment;
 		
 		//
 		// Constructors
@@ -20,21 +27,31 @@ namespace System.CodeDom {
 		{
 		}
 
+		public CodeCommentStatement (CodeComment comment)
+		{
+			this.comment = comment;
+		}
+
 		public CodeCommentStatement (string text)
 		{
-			this.text = text;
+			this.comment = new CodeComment( text );
+		}
+		
+		public CodeCommentStatement (string text, bool docComment)
+		{
+			this.comment = new CodeComment( text, docComment );
 		}
 
-		string Text {
+		//
+		// Properties
+		//
+		public CodeComment Comment {
 			get {
-				return text;
+				return comment;
 			}
-
 			set {
-				text = value;
+				comment = value;
 			}
 		}
 	}
 }
-
-			

+ 100 - 0
mcs/class/System/System.CodeDom/CodeCommentStatementCollection.cs

@@ -0,0 +1,100 @@
+//
+// System.CodeDom CodeCommentStatementCollection Class implementation
+//
+// Author:
+//   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+using System.Collections;
+
+namespace System.CodeDom 
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeCommentStatementCollection
+		: CollectionBase
+	{
+		//
+		// Constructors
+		//
+		public CodeCommentStatementCollection()
+		{
+		}
+		
+		public CodeCommentStatementCollection( CodeCommentStatement[] value )
+		{
+			AddRange( value );
+		}
+
+		public CodeCommentStatementCollection( CodeCommentStatementCollection value )
+		{
+			AddRange( value );
+		}
+
+		//
+		// Properties
+		//
+		public CodeCommentStatement this[int index]
+		{
+			get {
+				return (CodeCommentStatement)List[index];
+			}
+			set {
+				List[index] = value;
+			}
+		}
+
+		//
+		// Methods
+		//
+		public void Add (CodeCommentStatement value)
+		{
+			List.Add( value );
+		}
+
+		public void AddRange (CodeCommentStatement [] value )
+		{
+			foreach ( CodeCommentStatement elem in value )
+				Add( elem );
+		}
+		
+		public void AddRange (CodeCommentStatementCollection value)
+		{
+			foreach ( CodeCommentStatement elem in value )
+				Add( elem );
+		}
+
+		public bool Contains( CodeCommentStatement value )
+		{
+			return List.Contains( value );
+		}
+		
+		public void CopyTo( CodeCommentStatement[] array, int index )
+		{
+			List.CopyTo( array, index );
+		}
+
+		public int IndexOf( CodeCommentStatement value )
+		{
+			return List.IndexOf( value );
+		}
+
+		public void Insert( int index, CodeCommentStatement value )
+		{
+			List.Insert( index, value );
+		}
+
+		public void Remove( CodeCommentStatement value )
+		{
+			int index = IndexOf( value );
+			if ( index < 0 )
+				throw( new ArgumentException( "The specified object is not found in the collection" ) );
+			RemoveAt( index );
+		}
+	}
+}

+ 60 - 0
mcs/class/System/System.CodeDom/CodeCompileUnit.cs

@@ -0,0 +1,60 @@
+//
+// System.CodeDom CodeCompileUnit Class implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+using System.Collections.Specialized;
+
+namespace System.CodeDom
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeCompileUnit
+		: CodeObject
+	{
+		private CodeAttributeDeclarationCollection assemblyCustomAttributes;
+		private CodeNamespaceCollection namespaces;
+		private StringCollection referencedAssemblies;
+
+		//
+		// Constructors
+		//
+		public CodeCompileUnit()
+		{
+		}
+
+		//
+		// Properties
+		//
+		public CodeAttributeDeclarationCollection AssemblyCustomAttributes {
+			get {
+				if ( assemblyCustomAttributes == null )
+					assemblyCustomAttributes = 
+						new CodeAttributeDeclarationCollection();
+				return assemblyCustomAttributes;
+			}
+		}
+
+		public CodeNamespaceCollection Namespaces {
+			get {
+				if ( namespaces == null )
+					namespaces = new CodeNamespaceCollection();
+				return namespaces;
+			}
+		}
+
+		public StringCollection ReferencedAssemblies {
+			get {
+				if ( referencedAssemblies == null )
+					referencedAssemblies = new StringCollection();
+				return referencedAssemblies;
+			}
+		}
+	}
+}

+ 77 - 0
mcs/class/System/System.CodeDom/CodeConditionStatement.cs

@@ -0,0 +1,77 @@
+//
+// System.CodeDom CodeConditionStatement Class implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeConditionStatement
+		: CodeStatement
+	{
+		private CodeExpression condition;
+		private CodeStatementCollection trueStatements;
+		private CodeStatementCollection falseStatements;
+
+		//
+		// Constructors
+		//
+		public CodeConditionStatement()
+		{
+		}
+
+		public CodeConditionStatement( CodeExpression condition, 
+					       params CodeStatement[] trueStatements )
+		{
+			this.condition = condition;
+			this.TrueStatements.AddRange( trueStatements );
+		}
+
+		public CodeConditionStatement( CodeExpression condition,
+					       CodeStatement[] trueStatements,
+					       CodeStatement[] falseStatements )
+		{
+			this.condition = condition;
+			this.TrueStatements.AddRange( trueStatements );
+			this.FalseStatements.AddRange( falseStatements );
+		}
+		
+		//
+		// Properties
+		//
+		public CodeExpression Condition {
+			get {
+				return condition;
+			}
+			set {
+				condition = value;
+			}
+		}
+
+		public CodeStatementCollection FalseStatements {
+			get {
+				if ( falseStatements == null )
+					falseStatements = 
+						new CodeStatementCollection();
+				return falseStatements;
+			}
+		}
+
+		public CodeStatementCollection TrueStatements {
+			get {
+				if ( trueStatements == null )
+					trueStatements = 
+						new CodeStatementCollection();
+				return trueStatements;
+			}
+		}
+ 	}
+}

+ 18 - 17
mcs/class/System/System.CodeDom/CodeConstructor.cs

@@ -3,41 +3,42 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom 
+{
 	[Serializable]
-	public class CodeConstructor : CodeMemberMethod {
-		CodeExpressionCollection baseConstructorArgs;
-		CodeExpressionCollection chainedConstructorArgs;
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeConstructor
+		: CodeMemberMethod 
+	{
+		private CodeExpressionCollection baseConstructorArgs;
+		private CodeExpressionCollection chainedConstructorArgs;
 		
 		//
-		// Constructors
+		// Properties
 		//
-		public CodeConstructor ()
-		{
-		}
-
 		public CodeExpressionCollection BaseConstructorArgs {
 			get {
-				return baseConstructorArgs;
-			}
+				if ( baseConstructorArgs == null )
+					baseConstructorArgs = new CodeExpressionCollection();
 
-			set {
-				baseConstructorArgs = value;
+				return baseConstructorArgs;
 			}
 		}
 
 		public CodeExpressionCollection ChainedConstructorArgs {
 			get {
-				return chainedConstructorArgs;
-			}
+				if ( chainedConstructorArgs == null )
+					chainedConstructorArgs = new CodeExpressionCollection();
 
-			set {
-				chainedConstructorArgs = value;
+				return chainedConstructorArgs;
 			}
 		}
 	}

+ 20 - 15
mcs/class/System/System.CodeDom/CodeDelegateCreateExpression.cs

@@ -3,21 +3,33 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom 
+{
 	[Serializable]
-	public class CodeDelegateCreateExpression : CodeExpression {
-		string delegateType, methodName;
-		CodeExpression targetObject;
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeDelegateCreateExpression
+		: CodeExpression 
+	{
+		private CodeTypeReference delegateType;
+		private string methodName;
+		private CodeExpression targetObject;
 
 		//
 		// Constructors
 		//
-		public CodeDelegateCreateExpression (string delegateType,
+		public CodeDelegateCreateExpression ()
+		{
+		}
+
+		public CodeDelegateCreateExpression (CodeTypeReference delegateType,
 						     CodeExpression targetObject,
 						     string methodName)
 		{
@@ -26,39 +38,32 @@ namespace System.CodeDom {
 			this.methodName = methodName;
 		}
 
-		public CodeDelegateCreateExpression ()
-		{
-		}
 
 		//
 		// Properties
 		//
-
-		public string DelegateType {
+		public CodeTypeReference DelegateType {
 			get {
 				return delegateType;
 			}
-
 			set {
 				delegateType = value;
 			}
 		}
 
-		string MethodName {
+		public string MethodName {
 			get {
 				return methodName;
 			}
-
 			set {
 				methodName = value;
 			}
 		}
 
-		CodeExpression TargetObject {
+		public CodeExpression TargetObject {
 			get {
 				return targetObject;
 			}
-
 			set {
 				targetObject = value;
 			}

+ 23 - 19
mcs/class/System/System.CodeDom/CodeDelegateInvokeExpression.cs

@@ -3,16 +3,23 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom
+{
 	[Serializable]
-	public class CodeDelegateInvokeExpression : CodeExpression {
-		CodeExpressionCollection parameters;
-		CodeExpression targetObject;
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeDelegateInvokeExpression
+		: CodeExpression 
+	{
+		private CodeExpressionCollection parameters;
+		private CodeExpression targetObject;
 		
 		//
 		// Constructors
@@ -21,39 +28,36 @@ namespace System.CodeDom {
 		{
 		}
 		
-		public CodeDelegateInvokeExpression (CodeExpression targetObject,
-						     CodeExpression [] parameters)
+		public CodeDelegateInvokeExpression (CodeExpression targetObject)
 		{
 			this.targetObject = targetObject;
-			this.parameters = new CodeExpressionCollection ();
-			this.parameters.AddRange (parameters);
 		}
 
-		public CodeDelegateInvokeExpression (CodeExpression targetObject)
+		public CodeDelegateInvokeExpression (CodeExpression targetObject,
+						     CodeExpression [] parameters)
 		{
 			this.targetObject = targetObject;
+			this.Parameters.AddRange( parameters );
 		}
 
+
 		//
 		// Properties
 		//
-		public CodeExpression TargetObject {
+		public CodeExpressionCollection Parameters {
 			get {
-				return targetObject;
-			}
-
-			set {
-				targetObject = value;
+				if ( parameters == null )
+					parameters = new CodeExpressionCollection();
+				return parameters;
 			}
 		}
 
-		public CodeExpressionCollection Parameters {
+		public CodeExpression TargetObject {
 			get {
-				return parameters;
+				return targetObject;
 			}
-
 			set {
-				parameters = value;
+				targetObject = value;
 			}
 		}
 	}

+ 0 - 55
mcs/class/System/System.CodeDom/CodeDelegateInvokeStatement.cs

@@ -1,55 +0,0 @@
-//
-// System.CodeDom CodeDelegateInvokeStatement Class implementation
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// (C) 2001 Ximian, Inc.
-//
-
-namespace System.CodeDom {
-
-	public class CodeDelegateInvokeStatement : CodeStatement {
-		CodeStatementCollection parameters;
-		CodeStatement targetObject;
-		CodeDelegateInvokeExpression delegateInvoke;
-		
-		//
-		// Constructors
-		//
-		public CodeDelegateInvokeStatement ()
-		{
-		}
-
-		public CodeDelegateInvokeStatement (CodeStatement targetObject)
-		{
-			this.targetObject = targetObject;
-		}
-
-		public CodeDelegateInvokeStatement (CodeDelegateInvokeExpression delegateInvoke)
-		{
-			this.delegateInvoke = delegateInvoke;
-		}
-		
-		public CodeDelegateInvokeStatement (CodeStatement targetObject,
-						     CodeStatement [] parameters)
-		{
-			this.targetObject = targetObject;
-			this.parameters = new CodeStatementCollection ();
-			this.parameters.AddRange (parameters);
-		}
-
-		//
-		// Properties
-		//
-		public CodeDelegateInvokeExpression DelegateInvoke {
-			get {
-				return delegateInvoke;
-			}	
-
-			set {
-				delegateInvoke = value;
-			}
-		}
-	}
-}

+ 0 - 62
mcs/class/System/System.CodeDom/CodeDetachEventStatement.cs

@@ -1,62 +0,0 @@
-//
-// System.CodeDom CodeDetachEventStatement Class implementation
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// (C) 2001 Ximian, Inc.
-//
-
-namespace System.CodeDom {
-
-	public class CodeDetachEventStatement : CodeStatement {
-		string eventName;
-		CodeExpression targetObject, newListener;
-		
-		//
-		// Constructors
-		//
-		public CodeDetachEventStatement ()
-		{
-		}
-
-		public CodeDetachEventStatement (CodeExpression targetObject,
-						 string eventName,
-						 CodeExpression newListener)
-		{
-			this.targetObject = targetObject;
-			this.eventName = eventName;
-			this.newListener = newListener;
-		}
-
-		public string EventName {
-			get {
-				return eventName;
-			}
-
-			set {
-				eventName = value;
-			}
-		}
-
-		public CodeExpression TargetObject {
-			get {
-				return targetObject;
-			}
-
-			set {
-				targetObject = value;
-			}
-		}
-
-		public CodeExpression NewListener {
-			get {
-				return newListener;
-			}
-
-			set {
-				newListener = value;
-			}
-		}
-	}
-}

+ 59 - 0
mcs/class/System/System.CodeDom/CodeDirectionExpression.cs

@@ -0,0 +1,59 @@
+//
+// System.CodeDom FieldDirection Enum implementation
+//
+// Author:
+//   Sean MacIsaac ([email protected])
+//   Daniel Stodden ([email protected])
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom 
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeDirectionExpression
+		: CodeExpression
+	{
+		private FieldDirection direction;
+		private CodeExpression expression;
+
+		//
+		// Constructors
+		//
+		public CodeDirectionExpression()
+		{
+		}
+
+		public CodeDirectionExpression( FieldDirection direction, 
+						CodeExpression expression )
+		{
+			this.direction = direction;
+			this.expression = expression;
+		}
+
+		//
+		// Properties
+		//
+		public FieldDirection Direction {
+			get {
+				return direction;
+			}
+			set {
+				direction = value;
+			}
+		}
+
+		public CodeExpression Expression {
+			get {
+				return expression;
+			}
+			set {
+				expression = value;
+			}
+		}
+	}
+}

+ 21 - 0
mcs/class/System/System.CodeDom/CodeEntryPointMethod.cs

@@ -0,0 +1,21 @@
+//
+// System.CodeDom CodeEntryPointMethod Class implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeEntryPointMethod
+		: CodeMemberMethod
+	{
+	}
+}

+ 57 - 0
mcs/class/System/System.CodeDom/CodeEventReferenceExpression.cs

@@ -0,0 +1,57 @@
+//
+// System.CodeDom CodeEventReferenceExpression class implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeEventReferenceExpression
+		: CodeExpression
+	{
+		private string eventName;
+		private CodeExpression targetObject;
+
+		//
+		// Constructors
+		//
+		public CodeEventReferenceExpression()
+		{
+		}
+
+		public CodeEventReferenceExpression( CodeExpression targetObject, string EventName )
+		{
+			this.targetObject = targetObject;
+			this.eventName = eventName;
+		}
+
+		//
+		// Properties
+		//
+		public string EventName {
+			get {
+				return eventName;
+			}
+			set {
+				eventName = value;
+			}
+		}
+		
+		public CodeExpression TargetObject {
+			get {
+				return targetObject;
+			}
+			set {
+				targetObject = value;
+			}
+		}
+	}
+}

+ 8 - 23
mcs/class/System/System.CodeDom/CodeExpression.cs

@@ -7,30 +7,15 @@
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom 
+{
 	[Serializable]
-	public class CodeExpression : CodeObject {
-		object userData;
-		
-		//
-		// Constructors
-		//
-		public CodeExpression ()
-		{
-		}
-
-		//
-		// Properties
-		//
-		public object UserData {
-			get {
-				return userData;
-			}
-
-			set {
-				userData = value;
-			}
-		}
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeExpression
+		: CodeObject
+	{
 	}
 }

+ 50 - 115
mcs/class/System/System.CodeDom/CodeExpressionCollection.cs

@@ -3,163 +3,98 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
-
-	using System.Collections;
-	
-	public class CodeExpressionCollection : IList, ICollection, IEnumerable {
-
-		ArrayList expressions;
-		
+using System.Runtime.InteropServices;
+using System.Collections;
+
+namespace System.CodeDom 
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeExpressionCollection
+		: CollectionBase
+	{
 		//
 		// Constructors
 		//
-		public CodeExpressionCollection ()
+		public CodeExpressionCollection()
+		{
+		}
+		
+		public CodeExpressionCollection( CodeExpression[] value )
 		{
-			expressions = new ArrayList ();
+			AddRange( value );
+		}
+
+		public CodeExpressionCollection( CodeExpressionCollection value )
+		{
+			AddRange( value );
 		}
 
 		//
 		// Properties
 		//
-		public int Count {
+		public CodeExpression this[int index]
+		{
 			get {
-				return expressions.Count;
+				return (CodeExpression)List[index];
+			}
+			set {
+				List[index] = value;
 			}
 		}
 
-                public bool IsFixedSize {
-                        get {
-                                return true;
-                        }
-                }
-
 		//
 		// Methods
 		//
 		public void Add (CodeExpression value)
 		{
-			expressions.Add (value);
+			List.Add( value );
 		}
 
-		public void AddRange (CodeExpression [] values)
+		public void AddRange (CodeExpression [] value )
 		{
-			foreach (CodeExpression ca in values) 
-				expressions.Add (ca);
-
-		}
-
-		public void Clear ()
-		{
-			expressions.Clear ();
-		}
-
-		private class Enumerator : IEnumerator {
-			private CodeExpressionCollection collection;
-			private int currentIndex = -1;
-
-			internal Enumerator (CodeExpressionCollection collection)
-			{
-				this.collection = collection;
-			}
-
-			public object Current {
-				get {
-					if (currentIndex == collection.Count)
-						throw new InvalidOperationException ();
-					return collection [currentIndex];
-				}
-			}
-
-			public bool MoveNext ()
-			{
-				if (currentIndex > collection.Count)
-					throw new InvalidOperationException ();
-				return ++currentIndex < collection.Count;
-			}
-
-			public void Reset ()
-			{
-				currentIndex = -1;
-			}
+			foreach ( CodeExpression elem in value )
+				Add( elem );
 		}
 		
-		public IEnumerator GetEnumerator ()
-		{
-			return new CodeExpressionCollection.Enumerator (this);
-		}
-
-		//
-		// IList method implementations
-		//
-		public int Add (object value)
+		public void AddRange (CodeExpressionCollection value)
 		{
-			return expressions.Add (value);
+			foreach ( CodeExpression elem in value )
+				Add( elem );
 		}
 
-		public bool Contains (Object value)
+		public bool Contains( CodeExpression value )
 		{
-			return expressions.Contains (value);
+			return List.Contains( value );
 		}
-
-		public int IndexOf (Object value)
+		
+		public void CopyTo( CodeExpression[] array, int index )
 		{
-			return expressions.IndexOf (value);
+			List.CopyTo( array, index );
 		}
 
-		public void Insert (int index, Object value)
+		public int IndexOf( CodeExpression value )
 		{
-			expressions [index] = value;
+			return List.IndexOf( value );
 		}
 
-		public object this[int index] {
-			get {
-				return expressions [index];
-			}
-
-			set {
-				expressions [index] = value;
-			}
-		}
-
-		public void Remove (object value)
+		public void Insert( int index, CodeExpression value )
 		{
-			expressions.Remove (value);
+			List.Insert( index, value );
 		}
 
-		public void RemoveAt (int index)
+		public void Remove( CodeExpression value )
 		{
-			expressions.RemoveAt (index);
-		}
-
-		//
-		// ICollection method implementations
-		//
-		public void CopyTo (Array array, int index)
-		{
-			expressions.CopyTo (array, index);
-		}
-
-		public object SyncRoot {
-			get {
-				return expressions.SyncRoot;
-			}
-		}
-
-		public bool IsReadOnly {
-			get {
-				return false;
-			}
-		}
-
-		public bool IsSynchronized {
-			get {
-				return expressions.IsSynchronized;
-			}
+			int index = IndexOf( value );
+			if ( index < 0 )
+				throw( new ArgumentException( "The specified object is not found in the collection" ) );
+			RemoveAt( index );
 		}
 	}
 }

+ 46 - 0
mcs/class/System/System.CodeDom/CodeExpressionStatement.cs

@@ -0,0 +1,46 @@
+//
+// System.CodeDom CodeExpressionStatement Class implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeExpressionStatement
+		: CodeStatement
+	{
+		private CodeExpression expression;
+
+		//
+		// Constructors
+		//
+		public CodeExpressionStatement()
+		{
+		}
+
+		public CodeExpressionStatement(CodeExpression expression)
+		{
+			Expression = expression;
+		}
+
+		//
+		// Properties
+		//
+		public CodeExpression Expression {
+			get {
+				return expression;
+			}
+			set {
+				expression = value;
+			}
+		}
+	}
+}

+ 11 - 24
mcs/class/System/System.CodeDom/CodeFieldReferenceExpression.cs

@@ -3,24 +3,24 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom
+{
 	[Serializable]
-	public class CodeFieldReferenceExpression : CodeExpression {
-		CodeExpression targetObject;
-		string fieldName;
-		FieldDirection direction;
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeFieldReferenceExpression
+		: CodeExpression 
+	{
+		private CodeExpression targetObject;
+		private string fieldName;
 
-		public enum FieldDirection {
-			In,
-			Out,
-			Ref
-		}
-			
 		//
 		// Constructors
 		//
@@ -38,21 +38,10 @@ namespace System.CodeDom {
 		//
 		// Properties
 		//
-		public FieldDirection Direction {
-			get {
-				return direction;
-			}
-
-			set {
-				direction = value;
-			}
-		}
-
 		public string FieldName {
 			get {
 				return fieldName;
 			}
-
 			set {
 				fieldName = value;
 			}
@@ -62,11 +51,9 @@ namespace System.CodeDom {
 			get {
 				return targetObject;
 			}
-
 			set {
 				targetObject = value;
 			}
 		}
-		
 	}
 }

+ 0 - 78
mcs/class/System/System.CodeDom/CodeForLoopStatement.cs

@@ -1,78 +0,0 @@
-//
-// System.CodeDom CodeForLoopStatement Class implementation
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// (C) 2001 Ximian, Inc.
-//
-
-namespace System.CodeDom {
-
-	public class CodeForLoopStatement : CodeExpression {
-		CodeStatement initStatement, incrementStatement;
-		CodeExpression testExpression;
-		CodeStatementCollection statements;
-
-		//
-		// Constructors
-		//
-		public CodeForLoopStatement ()
-		{
-			statements = new CodeStatementCollection ();
-		}
-
-		public CodeForLoopStatement (CodeStatement initStatement,
-					     CodeExpression testExpression,
-					     CodeStatement incrementStatement,
-					     CodeStatement [] statements)
-		{
-			this.initStatement = initStatement;
-			this.testExpression = testExpression;
-			this.incrementStatement = incrementStatement;
-			this.statements = new CodeStatementCollection ();
-			this.statements.AddRange (statements);
-		}
-
-		//
-		// Properties
-		//
-		
-		public CodeStatement InitStatement {
-			get {
-				return initStatement;
-			}
-
-			set {
-				initStatement = value;
-			}
-		}
-
-		public CodeStatement IncrementStatement {
-			get {
-				return incrementStatement;
-			}
-
-			set {
-				incrementStatement = value;
-			}
-		}
-
-		public CodeStatementCollection Statements {
-			get {
-				return statements;
-			}
-		}
-
-		public CodeExpression TestExpression {
-			get {
-				return testExpression;
-			}
-
-			set {
-				testExpression = value;
-			}
-		}
-	}
-}
-

+ 42 - 0
mcs/class/System/System.CodeDom/CodeGotoStatement.cs

@@ -0,0 +1,42 @@
+//
+// System.CodeDom CodeGotoStatement Class implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeGotoStatement
+		: CodeStatement
+	{
+		private string label;
+
+		//
+		// Constructors
+		//
+		public CodeGotoStatement( string label )
+		{
+			Label = label;
+		}
+
+		//
+		// Properties
+		//
+		public string Label {
+			get {
+				return label;
+			}
+			set {
+				label = value;
+			}
+		}
+	}
+}

+ 0 - 73
mcs/class/System/System.CodeDom/CodeIfStatement.cs

@@ -1,73 +0,0 @@
-//
-// System.CodeDom CodeIfStatement Class implementation
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// (C) 2001 Ximian, Inc.
-//
-
-namespace System.CodeDom {
-
-	public class CodeIfStatement : CodeStatement {
-
-		CodeExpression condition;
-		CodeStatementCollection trueStatements;
-		CodeStatementCollection falseStatements;
-		
-		//
-		// Constructors
-		//
-		public CodeIfStatement ()
-		{
-			trueStatements = new CodeStatementCollection ();
-			falseStatements = new CodeStatementCollection ();
-		}
-		
-		public CodeIfStatement (CodeExpression condition, CodeStatement [] trueStatements)
-		{
-			this.condition = condition;
-			this.trueStatements = new CodeStatementCollection ();
-			this.trueStatements.AddRange (trueStatements);
-			this.falseStatements = new CodeStatementCollection ();
-		}
-
-		public CodeIfStatement (CodeExpression condition,
-					CodeStatement [] trueStatements,
-					CodeStatement [] falseStatements)
-		{
-			this.condition = condition;
-
-			this.trueStatements = new CodeStatementCollection ();
-			this.trueStatements.AddRange (trueStatements);
-
-			this.falseStatements = new CodeStatementCollection ();
-			this.falseStatements.AddRange (falseStatements);
-		}
-
-		//
-		// Properties
-		//
-		public CodeExpression Condition {
-			get {
-				return condition;
-			}
-
-			set {
-				condition = value;
-			}
-		}
-
-		public CodeStatementCollection FalseStatements {
-			get {
-				return falseStatements;
-			}
-		}
-		
-		public CodeStatementCollection TrueStatements {
-			get {
-				return trueStatements;
-			}
-		}
-	}
-}

+ 30 - 7
mcs/class/System/System.CodeDom/CodeIndexerExpression.cs

@@ -3,16 +3,23 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom 
+{
 	[Serializable]
-	public class CodeIndexerExpression : CodeExpression {
-		CodeExpression targetObject;
-		CodeExpression index;
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeIndexerExpression
+		: CodeExpression 
+	{
+		private CodeExpression targetObject;
+		private CodeExpressionCollection indices;
 
 		//
 		// Constructors
@@ -21,15 +28,31 @@ namespace System.CodeDom {
 		{
 		}
 		
-		public CodeIndexerExpression (CodeExpression targetObject, CodeExpression index)
+		public CodeIndexerExpression (CodeExpression targetObject, params CodeExpression[] indices)
 		{
-			this.index = index;
 			this.targetObject = targetObject;
+			this.Indices.AddRange( indices );
 		}
 
 		//
 		// Properties
 		//
+		public CodeExpressionCollection Indices {
+			get {
+				if ( indices == null )
+					indices = new CodeExpressionCollection();
+
+				return indices;
+			}
+		}
+
+		public CodeExpression TargetObject {
+			get {
+				return targetObject;
+			}
+			set {
+				targetObject = value;
+			}
+		}
 	}
 }
-

+ 81 - 0
mcs/class/System/System.CodeDom/CodeIterationStatement.cs

@@ -0,0 +1,81 @@
+//
+// System.CodeDom CodeIterationStatement Class implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeIterationStatement
+		: CodeStatement
+	{
+		private CodeStatement incrementStatement;
+		private CodeStatement initStatement;
+		private CodeStatementCollection statements;
+		private CodeExpression testExpression;
+		
+		//
+		// Constructors
+		//
+		public CodeIterationStatement()
+		{
+		}
+
+		public CodeIterationStatement( CodeStatement initStatement, 
+					       CodeExpression testExpression,
+					       CodeStatement incrementStatement,
+					       params CodeStatement[] statements )
+		{
+			this.initStatement = initStatement;
+			this.testExpression = testExpression;
+			this.incrementStatement = incrementStatement;
+			this.Statements.AddRange( statements );
+		}
+
+		//
+		// Properties
+		//
+		public CodeStatement IncrementStatement {
+			get {
+				return incrementStatement;
+			}
+			set {
+				incrementStatement = value;
+			}
+		}
+
+		public CodeStatement InitStatement {
+			get {
+				return initStatement;
+			}
+			set {
+				initStatement = value;
+			}
+		}
+
+		public CodeStatementCollection Statements {
+			get {
+				if ( statements == null )
+					statements = new CodeStatementCollection();
+				return statements;
+			}
+		}
+
+		public CodeExpression TestExpression {
+			get {
+				return testExpression;
+			}
+			set {
+				testExpression = value;
+			}
+		}
+	}
+}

+ 62 - 0
mcs/class/System/System.CodeDom/CodeLabeledStatement.cs

@@ -0,0 +1,62 @@
+//
+// System.CodeDom CodeLabeledStatement Class implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeLabeledStatement
+		: CodeStatement
+	{
+		private string label;
+		private CodeStatement statement;
+
+		//
+		// Constructors
+		//
+		public CodeLabeledStatement()
+		{
+		}
+
+		public CodeLabeledStatement( string label )
+		{
+			this.label = label;
+		}
+
+		public CodeLabeledStatement( string label, CodeStatement statement )
+		{
+			this.label = label;
+			this.statement = statement;
+		}
+
+		//
+		// Properties
+		//
+		public string Label {
+			get {
+				return label;
+			}
+			set {
+				label = value;
+			}
+		}
+
+		public CodeStatement Statement {
+			get {
+				return statement;
+			}
+			set {
+				statement = value;
+			}
+		}
+	}
+}

+ 12 - 7
mcs/class/System/System.CodeDom/CodeLinePragma.cs

@@ -6,19 +6,26 @@
 //
 // (C) 2001 Ximian, Inc.
 //
-using System;
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom 
+{
 	// <summary>
 	//    Use objects of this class to keep track of locations where
 	//    statements are defined
 	// </summary>
 	[Serializable]
-	public class CodeLinePragma {
-		string fileName;
-		int    lineNumber;
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeLinePragma 
+	{
+		private string fileName;
+		private int lineNumber;
 		
+		//
+		// Constructors
+		//
 		public CodeLinePragma (string fileName, int lineNumber)
 		{
 			this.fileName = fileName;
@@ -32,7 +39,6 @@ namespace System.CodeDom {
 			get {
 				return fileName;
 			}
-			
 			set {
 				fileName = value;
 			}
@@ -42,7 +48,6 @@ namespace System.CodeDom {
 			get {
 				return lineNumber;
 			}
-			
 			set {
 				lineNumber = value;
 			}

+ 0 - 40
mcs/class/System/System.CodeDom/CodeLiteralClassMember.cs

@@ -1,40 +0,0 @@
-//
-// System.CodeDom CodeLiteralClassMember Class implementation
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// (C) 2001 Ximian, Inc.
-//
-
-namespace System.CodeDom {
-
-	public class CodeLiteralClassMember : CodeClassMember {
-		string text;
-
-		//
-		// Constructors
-		//
-		public CodeLiteralClassMember ()
-		{
-		}
-
-		public CodeLiteralClassMember (string text)
-		{
-			this.text = text;
-		}
-
-		//
-		// Properties
-		//
-		string Text {
-			get {
-				return text;
-			}
-
-			set {
-				text = value;
-			}
-		}
-	}
-}

+ 0 - 40
mcs/class/System/System.CodeDom/CodeLiteralExpression.cs

@@ -1,40 +0,0 @@
-//
-// System.CodeDom CodeLiteralExpression Class implementation
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// (C) 2001 Ximian, Inc.
-//
-
-namespace System.CodeDom {
-
-	public class CodeLiteralExpression : CodeExpression {
-		string val;
-
-		//
-		// Constructors
-		//
-		public CodeLiteralExpression ()
-		{
-		}
-
-		public CodeLiteralExpression (string value)
-		{
-			val = value;
-		}
-
-		//
-		// Properties
-		//
-		string Value {
-			get {
-				return val;
-			}
-
-			set {
-				val = value;
-			}
-		}
-	}
-}

+ 0 - 48
mcs/class/System/System.CodeDom/CodeLiteralNamespace.cs

@@ -1,48 +0,0 @@
-//
-// System.CodeDom CodeLiteralNamespace Class implementation
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// (C) 2001 Ximian, Inc.
-//
-
-namespace System.CodeDom {
-
-	public class CodeLiteralNamespace : CodeNamespace {
-		CodeLinePragma linePragma;
-		string value;
-
-		//
-		// Constructors
-		//
-		public CodeLiteralNamespace (string value)
-		{ 
-			this.value = value;
-		}
-
-		//
-		// Properties
-		//
-		string Value {
-			get {
-				return value;
-			}
-
-			set {
-				this.value = value;
-			}
-		}
-
-		CodeLinePragma LinePragma {
-			get {
-				return linePragma;
-			}
-
-			set {
-				linePragma = value;
-			}
-		}
-	}
-}
-

+ 0 - 36
mcs/class/System/System.CodeDom/CodeLiteralStatement.cs

@@ -1,36 +0,0 @@
-//
-// System.CodeDom CodeLiteralStatement Class implementation
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// (C) 2001 Ximian, Inc.
-//
-
-namespace System.CodeDom {
-
-	public class CodeLiteralStatement : CodeStatement {
-		string value;
-
-		//
-		// Constructors
-		//
-		public CodeLiteralStatement (string value)
-		{
-			this.value = value;
-		}
-
-		//
-		// Properties
-		//
-		string Value {
-			get {
-				return value;
-			}
-
-			set {
-				this.value = value;
-			}
-		}
-	}
-}

+ 25 - 14
mcs/class/System/System.CodeDom/CodeMemberEvent.cs

@@ -3,46 +3,57 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom
+{
 	[Serializable]
-	public class CodeMemberEvent : CodeTypeMember {
-		string implementsType, type;
-		bool   privateImplements;
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeMemberEvent
+		: CodeTypeMember
+	{
+		private CodeTypeReference implementationType;
+		private CodeTypeReference privateImplementationType;
+		private CodeTypeReference type;
 		
+		//
+		// Constructors
+		//
 		public CodeMemberEvent ()
 		{
 		}
 
-		public string ImplementsType {
+		//
+		// Properties
+		//
+		public CodeTypeReference ImplementationTypes {
 			get {
-				return implementsType;
+				return implementationType;
 			}
-
 			set {
-				implementsType = value;
+				implementationType = value;
 			}
 		}
 
-		public bool PrivateImplements {
+		public CodeTypeReference PrivateImplementationType {
 			get {
-				return privateImplements;
+				return privateImplementationType;
 			}
-
 			set {
-				privateImplements = value;
+				privateImplementationType = value;
 			}
 		}
 
-		public string Type {
+		public CodeTypeReference Type {
 			get {
 				return type;
 			}
-
 			set {
 				type = value;
 			}

+ 28 - 10
mcs/class/System/System.CodeDom/CodeMemberField.cs

@@ -3,24 +3,44 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
-	public class CodeMemberField : CodeClassMember {
-		CodeExpression initExpression;
-		string type, name;
+namespace System.CodeDom 
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeMemberField
+		: CodeTypeMember
+	{
+		private CodeExpression initExpression;
+		private CodeTypeReference type;
 		
 		public CodeMemberField ()
 		{
 		}
 
-		public CodeMemberField (string type, string name)
+		public CodeMemberField (CodeTypeReference type, string name)
 		{
 			this.type = type;
-			this.name = name;
+			this.Name = name;
+		}
+		
+		public CodeMemberField (string type, string name)
+		{
+			this.type = new CodeTypeReference( type );
+			this.Name = name;
+		}
+			
+		public CodeMemberField (Type type, string name)
+		{
+			this.type = new CodeTypeReference( type );
+			this.Name = name;
 		}
 
 		//
@@ -30,19 +50,17 @@ namespace System.CodeDom {
 			get {
 				return initExpression;
 			}
-
 			set {
 				initExpression = value;
 			}
 		}
 
-		public string Type {
+		public CodeTypeReference Type {
 			get {
 				return type;
 			}
-
 			set {
-				type = name;
+				type = value;
 			}
 		}
 	}

+ 61 - 31
mcs/class/System/System.CodeDom/CodeMemberMethod.cs

@@ -3,72 +3,102 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom 
+{
 	[Serializable]
-	public class CodeMemberMethod : CodeTypeMember {
-		CodeParameterDeclarationExpressionCollection parameters;
-		CodeStatementCollection statements;
-		string implementsType;
-		string returnType;
-		bool   privateImplements;
-		
-		public CodeMemberMethod ()
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeMemberMethod
+		: CodeTypeMember 
+	{
+		private CodeTypeReferenceCollection implementationTypes;
+		private CodeParameterDeclarationExpressionCollection parameters;
+		private CodeTypeReference privateImplementationType;
+		private CodeTypeReference returnType;
+		private CodeStatementCollection statements;
+		private CodeAttributeDeclarationCollection returnTypeCustomAttributes;
+
+		//
+		// Constructors
+		//
+		public CodeMemberMethod()
 		{
 		}
 
-		public string ImplementsType {
+		//
+		// Properties
+		// 
+		public CodeTypeReferenceCollection ImplementationTypes {
 			get {
-				return implementsType;
-			}
-
-			set {
-				implementsType = value;
+				if ( implementationTypes == null ) {
+					implementationTypes = new CodeTypeReferenceCollection();
+					PopulateImplementationTypes( this, EventArgs.Empty );
+				}
+				return implementationTypes;
 			}
 		}
 
-		public bool PrivateImplements {
+		public CodeParameterDeclarationExpressionCollection Parameters {
 			get {
-				return privateImplements;
-			}
-
-			set {
-				privateImplements = value;
+				if ( parameters == null ) {
+					parameters = new CodeParameterDeclarationExpressionCollection();
+					PopulateParameters( this, EventArgs.Empty );
+				}
+				return parameters;
 			}
 		}
 
-		public string ReturnType {
+		public CodeTypeReference PrivateImplementationType {
 			get {
-				return returnType;
+				return privateImplementationType;
 			}
-
 			set {
-				returnType = value;
+				privateImplementationType = value;
 			}
 		}
 
-		public CodeParameterDeclarationExpressionCollection Parameters {
+		public CodeTypeReference ReturnType {
 			get {
-				return parameters;
+				return returnType;
 			}
-
 			set {
-				parameters = value;
+				returnType = value;
 			}
 		}
 
 		public CodeStatementCollection Statements {
 			get {
+				if ( statements == null ) {
+					statements = new CodeStatementCollection();
+					PopulateStatements( this, EventArgs.Empty );
+				}
 				return statements;
 			}
+		}
 
-			set {
-				statements = value;
+		public CodeAttributeDeclarationCollection ReturnTypeCustomAttributes {
+			get {
+				if ( returnTypeCustomAttributes == null )
+					returnTypeCustomAttributes = new CodeAttributeDeclarationCollection();
+				
+				return returnTypeCustomAttributes;
 			}
 		}
+
+		//
+		// Events
+		//
+		public event EventHandler PopulateImplementationTypes;
+
+		public event EventHandler PopulateParameters;
+
+		public event EventHandler PopulateStatements;
 	}
 }

+ 49 - 50
mcs/class/System/System.CodeDom/CodeMemberProperty.cs

@@ -3,20 +3,33 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom
+{
 	[Serializable]
-	public class CodeMemberProperty : CodeTypeMember {
-		CodeParameterDeclarationExpressionCollection parameters;
-		CodeStatementCollection getStatements, setStatements;
-		bool hasGet, hasSet;
-		string implementsType, type;
-		bool   privateImplements;
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeMemberProperty
+		: CodeTypeMember
+	{
+		private CodeStatementCollection getStatements;
+		private bool hasGet;
+		private bool hasSet;
+		private CodeTypeReferenceCollection implementationTypes;
+		private CodeParameterDeclarationExpressionCollection parameters;
+		private CodeTypeReference privateImplementationType;
+		private CodeStatementCollection setStatements;
+		private CodeTypeReference type;
 		
+		//
+		// Constructors
+		//
 		public CodeMemberProperty ()
 		{
 		}
@@ -24,86 +37,72 @@ namespace System.CodeDom {
 		//
 		// Properties
 		//
-
-		public string ImplementsType {
+		public CodeStatementCollection GetStatements {
 			get {
-				return implementsType;
-			}
-
-			set {
-				implementsType = value;
+				if ( getStatements == null )
+					getStatements = new CodeStatementCollection();
+				return getStatements;
 			}
 		}
 
-		public bool PrivateImplements {
+		public bool HasGet {
 			get {
-				return privateImplements;
+				return hasGet;
 			}
-
 			set {
-				privateImplements = value;
+				hasGet = value;
 			}
 		}
-
-		public CodeParameterDeclarationExpressionCollection Parameters {
+		
+		public bool HasSet {
 			get {
-				return parameters;
+				return hasSet;
 			}
-
 			set {
-				parameters = value;
+				hasSet = value;
 			}
 		}
 
-		public CodeStatementCollection SetStatements {
+		public CodeTypeReferenceCollection ImplementationTypes {
 			get {
-				return setStatements;
-			}
-
-			set {
-				setStatements = value;
+				if ( implementationTypes == null )
+					implementationTypes = new CodeTypeReferenceCollection();
+				return implementationTypes;
 			}
 		}
 
-		public CodeStatementCollection GetStatements {
+		public CodeParameterDeclarationExpressionCollection Parameters {
 			get {
-				return getStatements;
-			}
-
-			set {
-				getStatements = value;
+				if ( parameters == null )
+					parameters = new CodeParameterDeclarationExpressionCollection();
+				return parameters;
 			}
 		}
 
-		public string Type {
+		public CodeTypeReference PrivateImplementationType {
 			get {
-				return type;
+				return privateImplementationType;
 			}
-
 			set {
-				type = value;
+				privateImplementationType = value;
 			}
 		}
 
-		public bool HasGet {
+		public CodeStatementCollection SetStatements {
 			get {
-				return hasGet;
-			}
-
-			set {
-				hasGet = value;
+				if ( setStatements == null )
+					setStatements = new CodeStatementCollection();
+				return setStatements;
 			}
 		}
 
-		public bool HasSet {
+		public CodeTypeReference Type {
 			get {
-				return hasSet;
+				return type;
 			}
-
 			set {
-				hasSet = value;
+				type = value;
 			}
 		}
 	}
 }
-

+ 30 - 34
mcs/class/System/System.CodeDom/CodeMethodInvokeExpression.cs

@@ -3,67 +3,63 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom 
+{
 	[Serializable]
-	public class CodeMethodInvokeExpression : CodeExpression {
-		string methodName;
-		CodeExpression targetObject;
-		CodeExpressionCollection parameters;
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeMethodInvokeExpression
+		: CodeExpression 
+	{
+		private CodeMethodReferenceExpression method;
+		private CodeExpressionCollection parameters;
 		
 		//
 		// Constructors
 		//
-		public CodeMethodInvokeExpression () {}
+		public CodeMethodInvokeExpression () 
+		{
+		}
 
-		public CodeMethodInvokeExpression (CodeExpression targetObject, string methodName)
+		public CodeMethodInvokeExpression (CodeMethodReferenceExpression method, params CodeExpression[] parameters)
 		{
-			this.targetObject = targetObject;
-			this.methodName = methodName;
+			this.method = method;
+			this.Parameters.AddRange( parameters );
 		}
 
-		public CodeMethodInvokeExpression (CodeExpression targetObject,
-						   string methodName,
-						   CodeExpression [] parameters)
+		public CodeMethodInvokeExpression ( CodeExpression targetObject,
+						    string methodName,
+						    CodeExpression [] parameters)
 		{
-			this.targetObject = targetObject;
-			this.methodName = methodName;
-			this.parameters = new CodeExpressionCollection ();
-			this.parameters.AddRange (parameters);
+			this.method = new CodeMethodReferenceExpression( targetObject, methodName );
+			this.Parameters.AddRange (parameters);
 		}
 
-		public string MethodName {
+		//
+		// Properties
+		//
+		public CodeMethodReferenceExpression Method {
 			get {
-				return methodName;
+				return method;
 			}
-
 			set {
-				methodName = value;
+				method = value;
 			}
 		}
 
 		public CodeExpressionCollection Parameters {
 			get {
+				if ( parameters == null )
+					parameters = new CodeExpressionCollection();
 				return parameters;
 			}
-
-			set {
-				parameters = value;
-			}
-		}
-
-		public CodeExpression TargetObject {
-			get {
-				return targetObject;
-			}
-
-			set {
-				targetObject = value;
-			}
 		}
 	}
 }

+ 0 - 84
mcs/class/System/System.CodeDom/CodeMethodInvokeStatement.cs

@@ -1,84 +0,0 @@
-//
-// System.CodeDom CodeMethodInvokeStatement Class implementation
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// (C) 2001 Ximian, Inc.
-//
-
-namespace System.CodeDom {
-
-	public class CodeMethodInvokeStatement : CodeStatement {
-		string methodName;
-		CodeExpression targetObject;
-		CodeExpressionCollection parameters;
-		CodeMethodInvokeExpression methodInvoke;
-		
-		//
-		// Constructors
-		//
-		public CodeMethodInvokeStatement () {}
-
-		public CodeMethodInvokeStatement (CodeMethodInvokeExpression methodInvoke)
-		{
-			this.methodInvoke = methodInvoke;
-		}
-		
-		public CodeMethodInvokeStatement (CodeExpression targetObject, string methodName)
-		{
-			this.targetObject = targetObject;
-			this.methodName = methodName;
-		}
-
-		public CodeMethodInvokeStatement (CodeExpression targetObject,
-						  string methodName,
-						  CodeExpression [] parameters)
-		{
-			this.targetObject = targetObject;
-			this.methodName = methodName;
-			this.parameters = new CodeExpressionCollection ();
-			this.parameters.AddRange (parameters);
-		}
-
-		public string MethodName {
-			get {
-				return methodName;
-			}
-
-			set {
-				methodName = value;
-			}
-		}
-
-		public CodeExpressionCollection Parameters {
-			get {
-				return parameters;
-			}
-
-			set {
-				parameters = value;
-			}
-		}
-
-		public CodeExpression TargetObject {
-			get {
-				return targetObject;
-			}
-
-			set {
-				targetObject = value;
-			}
-		}
-
-		public CodeMethodInvokeExpression MethodInvoke {
-			get {
-				return methodInvoke;
-			}
-
-			set {
-				methodInvoke = value;
-			}
-		}
-	}
-}

+ 59 - 0
mcs/class/System/System.CodeDom/CodeMethodReferenceExpression.cs

@@ -0,0 +1,59 @@
+//
+// System.CodeDom CodeMethodInvokeExpression Class implementation
+//
+// Author:
+//   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom 
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeMethodReferenceExpression
+		: CodeExpression 
+	{
+		private string methodName;
+		private CodeExpression targetObject;
+		
+		//
+		// Constructors
+		//
+		public CodeMethodReferenceExpression ()
+		{
+		}
+
+		public CodeMethodReferenceExpression (CodeExpression targetObject, 
+						      string methodName)
+		{
+			this.targetObject = targetObject;
+			this.methodName = methodName;
+		}
+
+		//
+		// Properties
+		//
+		public string MethodName {
+			get {
+				return methodName;
+			}
+			set {
+				methodName = value;
+			}
+		}
+
+		public CodeExpression TargetObject {
+			get {
+				return targetObject;
+			}
+			set {
+				targetObject = value;
+			}
+		}
+	}
+}

+ 33 - 1
mcs/class/System/System.CodeDom/CodeMethodReturnStatement.cs

@@ -3,13 +3,45 @@
 //
 // Author:
 //   Sean MacIsaac ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
+using System.Runtime.InteropServices;
+
 namespace System.CodeDom
 {
-	public class CodeMethodReturnStatement : CodeStatement
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeMethodReturnStatement
+		: CodeStatement
 	{
+		private CodeExpression expression;
+
+		//
+		// Constructors
+		//
+		public CodeMethodReturnStatement()
+		{
+		}
+		
+		public CodeMethodReturnStatement( CodeExpression expression )
+		{
+			this.expression = expression;
+		}
+		
+		//
+		// Properties
+		//
+		public CodeExpression Expression {
+			get {
+				return expression;
+			}
+			set {
+				expression = value;
+			}
+		}
 	}
 }

+ 42 - 46
mcs/class/System/System.CodeDom/CodeNamespace.cs

@@ -3,25 +3,34 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom
+{
 	[Serializable]
-	public class CodeNamespace : CodeObject {
-		CodeClassCollection classes;
-		CodeNamespaceImportCollection imports;
-		bool allowLateBound, requireVariableDeclaration;
-		string name;
-		object userData;
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeNamespace
+		: CodeObject
+	{
+		private CodeCommentStatementCollection comments;
+		private CodeNamespaceImportCollection imports;
+		private CodeTypeDeclarationCollection types;
+		private string name;
 
-		public CodeNamespace  ()
+		//
+		// Constructors
+		//
+		public CodeNamespace()
 		{
 		}
 
-		public CodeNamespace (string name)
+		public CodeNamespace(string name)
 		{
 			this.name = name;
 		}
@@ -29,65 +38,52 @@ namespace System.CodeDom {
 		//
 		// Properties
 		//
-
-		public bool AllowLateBound {
-			get {
-				return allowLateBound;
-			}
-
-			set {
-				allowLateBound = value;
-			}
-		}
-
-		public CodeClassCollection Classes {
+		public CodeCommentStatementCollection Comments {
 			get {
-				return classes;
-			}
-
-			set {
-				classes = value;
+				if ( comments == null ) {
+					comments = new CodeCommentStatementCollection();
+					PopulateComments( this, EventArgs.Empty );
+				}
+				return comments;
 			}
 		}
 
 		public CodeNamespaceImportCollection Imports {
 			get {
+				if ( imports == null ) {
+					imports = new CodeNamespaceImportCollection();
+					PopulateImports( this, EventArgs.Empty );
+				}
 				return imports;
 			}
-
-			set {
-				imports = value;
-			}
 		}
 
 		public string Name {
 			get {
 				return name;
 			}
-
 			set {
 				name = value;
 			}
 		}
 
-		public bool RequireVariableDeclaration {
+		public CodeTypeDeclarationCollection Types {
 			get {
-				return requireVariableDeclaration;
-			}
-
-			set {
-				requireVariableDeclaration = value;
+				if ( types == null ) {
+					types = new CodeTypeDeclarationCollection();
+					PopulateTypes( this, EventArgs.Empty );
+				}
+				return types;
 			}
 		}
 
-		public object UserData {
-			get {
-				return userData;
-			}
-
-			set {
-				userData = value;
-			}
-		}
+		//
+		// Events
+		//
+		public event EventHandler PopulateComments;
+		
+		public event EventHandler PopulateImports;
+		
+		public event EventHandler PopulateTypes;
 	}
 }

+ 99 - 0
mcs/class/System/System.CodeDom/CodeNamespaceCollection.cs

@@ -0,0 +1,99 @@
+//
+// System.CodeDom CodeNamespaceCollection Class implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+using System.Collections;
+
+namespace System.CodeDom 
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeNamespaceCollection
+		: CollectionBase
+	{
+		//
+		// Constructors
+		//
+		public CodeNamespaceCollection()
+		{
+		}
+
+		public CodeNamespaceCollection( CodeNamespace[] value )
+		{
+			AddRange( value );
+		}
+
+		public CodeNamespaceCollection( CodeNamespaceCollection value )
+		{
+			AddRange( value );
+		}
+		
+		//
+		// Properties
+		//
+		public CodeNamespace this[int index]
+		{
+			get {
+				return (CodeNamespace)List[index];
+			}
+			set {
+				List[index] = value;
+			}
+		}
+
+		//
+		// Methods
+		//
+		public void Add (CodeNamespace value)
+		{
+			List.Add( value );
+		}
+
+		public void AddRange (CodeNamespace [] value )
+		{
+			foreach ( CodeNamespace elem in value )
+				Add( elem );
+		}
+		
+		public void AddRange (CodeNamespaceCollection value)
+		{
+			foreach ( CodeNamespace elem in value )
+				Add( elem );
+		}
+
+		public bool Contains( CodeNamespace value )
+		{
+			return List.Contains( value );
+		}
+		
+		public void CopyTo( CodeNamespace[] array, int index )
+		{
+			List.CopyTo( array, index );
+		}
+
+		public int IndexOf( CodeNamespace value )
+		{
+			return List.IndexOf( value );
+		}
+
+		public void Insert( int index, CodeNamespace value )
+		{
+			List.Insert( index, value );
+		}
+
+		public void Remove( CodeNamespace value )
+		{
+			int index = IndexOf( value );
+			if ( index < 0 )
+				throw( new ArgumentException( "The specified object is not found in the collection" ) );
+			RemoveAt( index );
+		}
+	}
+}

+ 25 - 5
mcs/class/System/System.CodeDom/CodeNamespaceImport.cs

@@ -3,17 +3,30 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom
+{
 	[Serializable]
-	public class CodeNamespaceImport : CodeObject {
-		string nameSpace;
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeNamespaceImport
+		: CodeObject 
+	{
+		private CodeLinePragma linePragma;
+		private string nameSpace;
 		
-		public CodeNamespaceImport () {}
+		//
+		// Constructors
+		//
+		public CodeNamespaceImport ()
+		{
+		}
 
 		public CodeNamespaceImport (string nameSpace)
 		{
@@ -23,12 +36,19 @@ namespace System.CodeDom {
 		//
 		// Properties
 		//
+		public CodeLinePragma LinePragma {
+			get {
+				return linePragma;
+			}
+			set {
+				linePragma = value;
+			}
+		}
 
 		public string Namespace {
 			get {
 				return nameSpace;
 			}
-
 			set {
 				nameSpace = value;
 			}

+ 67 - 83
mcs/class/System/System.CodeDom/CodeNamespaceImportCollection.cs

@@ -3,25 +3,35 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
+using System.Collections;
 
-	using System.Collections;
-	
+namespace System.CodeDom
+{
+	/*
+	 * Should probably be derived from CollectionBase like any
+	 * other System.CodeDom.*Collection. MS docs say it currently
+	 * is not, for whichever reason.
+	 */
 	[Serializable]
-	public class CodeNamespaceImportCollection : IList, ICollection, IEnumerable {
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeNamespaceImportCollection
+		: IList, ICollection, IEnumerable
+	{
+		private ArrayList namespaceImports;
 
-		ArrayList namespaceImports;
-		
 		//
 		// Constructors
 		//
 		public CodeNamespaceImportCollection ()
 		{
-			namespaceImports = new ArrayList ();
+			namespaceImports = new ArrayList();
 		}
 
 		//
@@ -33,10 +43,13 @@ namespace System.CodeDom {
 			}
 		}
 
-                public bool IsFixedSize {
+                public CodeNamespaceImport this [int index] {
                         get {
-                                return true;
+                                return (CodeNamespaceImport)namespaceImports[index];
                         }
+			set {
+				namespaceImports[index] = value;
+			}
                 }
 
 		//
@@ -47,11 +60,10 @@ namespace System.CodeDom {
 			namespaceImports.Add (value);
 		}
 
-		public void AddRange (CodeNamespaceImport [] values)
+		public void AddRange (CodeNamespaceImport [] value)
 		{
-			foreach (CodeNamespaceImport ca in values) 
-				namespaceImports.Add (ca);
-
+			foreach (CodeNamespaceImport elem in value) 
+				namespaceImports.Add (elem);
 		}
 
 		public void Clear ()
@@ -59,108 +71,80 @@ namespace System.CodeDom {
 			namespaceImports.Clear ();
 		}
 
-		private class Enumerator : IEnumerator {
-			private CodeNamespaceImportCollection collection;
-			private int currentIndex = -1;
-
-			internal Enumerator (CodeNamespaceImportCollection collection)
-			{
-				this.collection = collection;
+		// IList implementation
+		bool IList.IsFixedSize {
+			get {
+				return false;
 			}
+		}
 
-			public object Current {
-				get {
-					if (currentIndex == collection.Count)
-						throw new InvalidOperationException ();
-					return collection [currentIndex];
-				}
+		bool IList.IsReadOnly {
+			get {
+				return false;
 			}
+		}
 
-			public bool MoveNext ()
-			{
-				if (currentIndex > collection.Count)
-					throw new InvalidOperationException ();
-				return ++currentIndex < collection.Count;
+		object IList.this[int index] {
+			get {
+				return namespaceImports[index];
 			}
-
-			public void Reset ()
-			{
-				currentIndex = -1;
+			set {
+				namespaceImports[index] = value;
 			}
 		}
-		
-		public IEnumerator GetEnumerator ()
-		{
-			return new CodeNamespaceImportCollection.Enumerator (this);
-		}
 
-		//
-		// IList method implementations
-		//
-		public int Add (object value)
-		{
-			return namespaceImports.Add (value);
-		}
-
-		public bool Contains (Object value)
+		int IList.Add( object value )
 		{
-			return namespaceImports.Contains (value);
+			return namespaceImports.Add( value );
 		}
-
-		public int IndexOf (Object value)
+		
+		bool IList.Contains( object value )
 		{
-			return namespaceImports.IndexOf (value);
+			return namespaceImports.Contains( value );
 		}
-
-		public void Insert (int index, Object value)
+		
+		int IList.IndexOf( object value )
 		{
-			namespaceImports [index] = value;
-		}
-
-		public object this[int index] {
-			get {
-				return namespaceImports [index];
-			}
-
-			set {
-				namespaceImports [index] = value;
-			}
+			return namespaceImports.IndexOf( value );
 		}
 
-		public void Remove (object value)
+		void IList.Insert( int index, object value )
 		{
-			namespaceImports.Remove (value);
+			namespaceImports.Insert( index, value );
 		}
 
-		public void RemoveAt (int index)
+		void IList.Remove( object value )
 		{
-			namespaceImports.RemoveAt (index);
+			namespaceImports.Remove( value );
 		}
-
-		//
-		// ICollection method implementations
-		//
-		public void CopyTo (Array array, int index)
+		
+		void IList.RemoveAt( int index )
 		{
-			namespaceImports.CopyTo (array, index);
+			namespaceImports.RemoveAt( index );
 		}
 
-		public object SyncRoot {
+		// ICollection implementation
+		object ICollection.SyncRoot {
 			get {
 				return namespaceImports.SyncRoot;
 			}
 		}
 
-		public bool IsReadOnly {
+		bool ICollection.IsSynchronized {
 			get {
-				return false;
+				return namespaceImports.IsSynchronized;
 			}
 		}
 
-		public bool IsSynchronized {
-			get {
-				return namespaceImports.IsSynchronized;
-			}
+		void ICollection.CopyTo( Array array, int index )
+		{
+			namespaceImports.CopyTo( array, index );
+		}
+
+		// IEnumerable implementation
+		public IEnumerator GetEnumerator ()
+		{
+			return namespaceImports.GetEnumerator();
 		}
 	}
 }

+ 19 - 0
mcs/class/System/System.CodeDom/CodeObject.cs

@@ -3,14 +3,33 @@
 //
 // Author:
 //   Sean MacIsaac ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
+using System.Runtime.InteropServices;
+using System.Collections;
+using System.Collections.Specialized;
+
 namespace System.CodeDom
 {
 	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
 	public class CodeObject
 	{
+		private IDictionary userData;
+
+		//
+		// Properties
+		//
+		public IDictionary UserData {
+			get {
+				if ( userData == null )
+					userData = new ListDictionary();
+				return userData;
+			}
+		}
 	}
 }

+ 34 - 17
mcs/class/System/System.CodeDom/CodeObjectCreateExpression.cs

@@ -3,39 +3,59 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom 
+{
 	[Serializable]
-	public class CodeObjectCreateExpression : CodeExpression {
-		string createType;
-		CodeExpressionCollection parameters;
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeObjectCreateExpression
+		: CodeExpression 
+	{
+		private CodeTypeReference createType;
+		private CodeExpressionCollection parameters;
 		
-		public CodeObjectCreateExpression () {}
+		//
+		// Constructors
+		//
+		public CodeObjectCreateExpression () 
+		{
+		}
 
-		public CodeObjectCreateExpression (string createType)
+		public CodeObjectCreateExpression (CodeTypeReference createType, 
+						   params CodeExpression [] parameters)
 		{
 			this.createType = createType;
+			this.Parameters.AddRange( parameters );
 		}
 
-		public CodeObjectCreateExpression (string createType, CodeExpression [] parameters)
+		public CodeObjectCreateExpression (string createType, 
+						   params CodeExpression [] parameters)
 		{
-			this.createType = createType;
-			this.parameters = new CodeExpressionCollection ();
-			this.parameters.AddRange (parameters);
+			this.createType = new CodeTypeReference( createType );
+			this.Parameters.AddRange( parameters );
+		}
+
+		public CodeObjectCreateExpression (Type createType, 
+						   params CodeExpression [] parameters)
+		{
+			this.createType = new CodeTypeReference( createType );
+			this.Parameters.AddRange( parameters );
 		}
 
 		//
 		// Properties
 		//
-		public string CreateType {
+		public CodeTypeReference CreateType {
 			get {
 				return createType;
 			}
-
 			set {
 				createType = value;
 			}
@@ -43,13 +63,10 @@ namespace System.CodeDom {
 
 		public CodeExpressionCollection Parameters {
 			get {
+				if ( parameters == null )
+					parameters = new CodeExpressionCollection();
 				return parameters;
 			}
-
-			set {
-				parameters = value;
-			}
 		}
-		
 	}
 }

+ 45 - 26
mcs/class/System/System.CodeDom/CodeParameterDeclarationExpression.cs

@@ -7,63 +7,82 @@
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom
+{
 	[Serializable]
-	public class CodeParameterDeclarationExpression : CodeExpression {
-		FieldDirection direction;
-		CodeAttributeBlock customAttributes;
-		string type, name;
-		
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeParameterDeclarationExpression
+		: CodeExpression 
+	{
+		private CodeAttributeDeclarationCollection customAttributes;
+		private FieldDirection direction;
+		private string name;
+		private CodeTypeReference type;
+
+		//
+		// Constructors
+		//
 		public CodeParameterDeclarationExpression ()
 		{
 		}
 
-		public CodeParameterDeclarationExpression (string type, string name)
+		public CodeParameterDeclarationExpression( CodeTypeReference type, string name )
 		{
 			this.type = type;
 			this.name = name;
 		}
 
-		public string Type {
-			get {
-				return type;
-			}
+		public CodeParameterDeclarationExpression (string type, string name)
+		{
+			this.type = new CodeTypeReference( type );
+			this.name = name;
+		}
 
-			set {
-				type = value;
-			}
+		public CodeParameterDeclarationExpression (Type type, string name)
+		{
+			this.type = new CodeTypeReference( type );
+			this.name = name;
 		}
 
-		public string Name {
+		//
+		// Properties
+		//
+		public CodeAttributeDeclarationCollection CustomAttributes {
 			get {
-				return name;
+				if ( customAttributes == null )
+					customAttributes = new CodeAttributeDeclarationCollection();
+				return customAttributes;
 			}
+		}
 
+		public FieldDirection Direction {
+			get {
+				return direction;
+			}
 			set {
-				name = value;
+				direction = value;
 			}
 		}
 
-		public CodeAttributeBlock CustomAttributes {
+		public string Name {
 			get {
-				return customAttributes;
+				return name;
 			}
-
 			set {
-				customAttributes = value;
+				name = value;
 			}
 		}
 
-		public FieldDirection Direction {
+		public CodeTypeReference Type {
 			get {
-				return direction;
+				return type;
 			}
-
 			set {
-				direction = value;
+				type = value;
 			}
 		}
 	}
 }
-

+ 48 - 114
mcs/class/System/System.CodeDom/CodeParameterDeclarationExpressionCollection.cs

@@ -3,164 +3,98 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
+using System.Collections;
 
-	using System.Collections;
-	
+namespace System.CodeDom 
+{
 	[Serializable]
-	public class CodeParameterDeclarationExpressionCollection : IList, ICollection, IEnumerable {
-
-		ArrayList parameterDeclExprs;
-		
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeParameterDeclarationExpressionCollection
+		: CollectionBase
+	{
 		//
 		// Constructors
 		//
-		public CodeParameterDeclarationExpressionCollection ()
+		public CodeParameterDeclarationExpressionCollection()
+		{
+		}
+
+		public CodeParameterDeclarationExpressionCollection( CodeParameterDeclarationExpression[] value )
+		{
+			AddRange( value );
+		}
+		
+		public CodeParameterDeclarationExpressionCollection( CodeParameterDeclarationExpressionCollection value )
 		{
-			parameterDeclExprs = new ArrayList ();
+			AddRange( value );
 		}
 
 		//
 		// Properties
 		//
-		public int Count {
+		public CodeParameterDeclarationExpression this[int index]
+		{
 			get {
-				return parameterDeclExprs.Count;
+				return (CodeParameterDeclarationExpression)List[index];
+			}
+			set {
+				List[index] = value;
 			}
 		}
 
-                public bool IsFixedSize {
-                        get {
-                                return true;
-                        }
-                }
-
 		//
 		// Methods
 		//
 		public void Add (CodeParameterDeclarationExpression value)
 		{
-			parameterDeclExprs.Add (value);
+			List.Add( value );
 		}
 
-		public void AddRange (CodeParameterDeclarationExpression [] values)
+		public void AddRange (CodeParameterDeclarationExpression [] value )
 		{
-			foreach (CodeParameterDeclarationExpression ca in values) 
-				parameterDeclExprs.Add (ca);
-
-		}
-
-		public void Clear ()
-		{
-			parameterDeclExprs.Clear ();
-		}
-
-		private class Enumerator : IEnumerator {
-			private CodeParameterDeclarationExpressionCollection collection;
-			private int currentIndex = -1;
-
-			internal Enumerator (CodeParameterDeclarationExpressionCollection collection)
-			{
-				this.collection = collection;
-			}
-
-			public object Current {
-				get {
-					if (currentIndex == collection.Count)
-						throw new InvalidOperationException ();
-					return collection [currentIndex];
-				}
-			}
-
-			public bool MoveNext ()
-			{
-				if (currentIndex > collection.Count)
-					throw new InvalidOperationException ();
-				return ++currentIndex < collection.Count;
-			}
-
-			public void Reset ()
-			{
-				currentIndex = -1;
-			}
+			foreach ( CodeParameterDeclarationExpression elem in value )
+				Add( elem );
 		}
 		
-		public IEnumerator GetEnumerator ()
+		public void AddRange (CodeParameterDeclarationExpressionCollection value)
 		{
-			return new CodeParameterDeclarationExpressionCollection.Enumerator (this);
+			foreach ( CodeParameterDeclarationExpression elem in value )
+				Add( elem );
 		}
 
-		//
-		// IList method implementations
-		//
-		public int Add (object value)
+		public bool Contains( CodeParameterDeclarationExpression value )
 		{
-			return parameterDeclExprs.Add (value);
+			return List.Contains( value );
 		}
-
-		public bool Contains (Object value)
-		{
-			return parameterDeclExprs.Contains (value);
-		}
-
-		public int IndexOf (Object value)
-		{
-			return parameterDeclExprs.IndexOf (value);
-		}
-
-		public void Insert (int index, Object value)
+		
+		public void CopyTo( CodeParameterDeclarationExpression[] array, int index )
 		{
-			parameterDeclExprs [index] = value;
-		}
-
-		public object this[int index] {
-			get {
-				return parameterDeclExprs [index];
-			}
-
-			set {
-				parameterDeclExprs [index] = value;
-			}
+			List.CopyTo( array, index );
 		}
 
-		public void Remove (object value)
+		public int IndexOf( CodeParameterDeclarationExpression value )
 		{
-			parameterDeclExprs.Remove (value);
+			return List.IndexOf( value );
 		}
 
-		public void RemoveAt (int index)
+		public void Insert( int index, CodeParameterDeclarationExpression value )
 		{
-			parameterDeclExprs.RemoveAt (index);
+			List.Insert( index, value );
 		}
 
-		//
-		// ICollection method implementations
-		//
-		public void CopyTo (Array array, int index)
+		public void Remove( CodeParameterDeclarationExpression value )
 		{
-			parameterDeclExprs.CopyTo (array, index);
-		}
-
-		public object SyncRoot {
-			get {
-				return parameterDeclExprs.SyncRoot;
-			}
-		}
-
-		public bool IsReadOnly {
-			get {
-				return false;
-			}
-		}
-
-		public bool IsSynchronized {
-			get {
-				return parameterDeclExprs.IsSynchronized;
-			}
+			int index = IndexOf( value );
+			if ( index < 0 )
+				throw( new ArgumentException( "The specified object is not found in the collection" ) );
+			RemoveAt( index );
 		}
 	}
 }

+ 20 - 8
mcs/class/System/System.CodeDom/CodePrimitiveExpression.cs

@@ -7,28 +7,40 @@
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom 
+{
 	[Serializable]
-	public class CodePrimitiveExpression : CodeExpression {
-		object value;
-		
-		public CodePrimitiveExpression () {}
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodePrimitiveExpression
+		: CodeExpression 
+	{
+		private object value;
+
+		//
+		// Constructors
+		//
+		public CodePrimitiveExpression ()
+		{
+		}
 
 		public CodePrimitiveExpression (Object value)
 		{
 			this.value = value;
 		}
 
+		//
+		// Properties
+		//
 		public object Value {
 			get {
-				return value;
+				return this.value;
 			}
-
 			set {
 				this.value = value;
 			}
 		}
 	}
 }
-

+ 17 - 18
mcs/class/System/System.CodeDom/CodePropertyReferenceExpression.cs

@@ -3,19 +3,30 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom
+{
 	[Serializable]
-	public class CodePropertyReferenceExpression : CodeExpression {
-		CodeExpressionCollection parameters;
-		CodeExpression targetObject;
-		string propertyName;
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodePropertyReferenceExpression
+		: CodeExpression 
+	{
+		private CodeExpression targetObject;
+		private string propertyName;
 		
-		public CodePropertyReferenceExpression () {}
+		//
+		// Constructors
+		//
+		public CodePropertyReferenceExpression () 
+		{
+		}
 
 		public CodePropertyReferenceExpression (CodeExpression targetObject,
 							string propertyName)
@@ -27,21 +38,10 @@ namespace System.CodeDom {
 		//
 		// Properties
 		//
-		public CodeExpressionCollection Parameter {
-			get {
-				return parameters;
-			}
-
-			set {
-				parameters = value;
-			}
-		}
-
 		public string PropertyName {
 			get {
 				return propertyName;
 			}
-
 			set {
 				propertyName = value;
 			}
@@ -51,7 +51,6 @@ namespace System.CodeDom {
 			get {
 				return targetObject;
 			}
-
 			set {
 				targetObject = value;
 			}

+ 21 - 0
mcs/class/System/System.CodeDom/CodePropertySetValueReferenceExpression.cs

@@ -0,0 +1,21 @@
+//
+// System.CodeDom CodePropertySetValueReferenceExpression Class implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodePropertySetValueReferenceExpression
+		: CodeExpression
+	{
+	}
+}

+ 68 - 0
mcs/class/System/System.CodeDom/CodeRemoveEventStatement.cs

@@ -0,0 +1,68 @@
+//
+// System.CodeDom CodeRemoveEventStatement Class implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom 
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeRemoveEventStatement
+		: CodeStatement 
+	{
+		private CodeEventReferenceExpression eventRef;
+		private CodeExpression listener;
+
+		//
+		// Constructors
+		//
+		public CodeRemoveEventStatement ()
+		{
+		}
+
+		public CodeRemoveEventStatement (CodeEventReferenceExpression eventRef,
+						 CodeExpression listener)
+		{
+			this.eventRef = eventRef;
+			this.listener = listener;
+		}
+
+		public CodeRemoveEventStatement (CodeExpression targetObject,
+						 string eventName,
+						 CodeExpression listener)
+		{
+			this.eventRef = new CodeEventReferenceExpression( targetObject,
+									  eventName );
+			this.listener = listener;
+		}
+
+		//
+		// Properties
+		//
+		public CodeEventReferenceExpression Event {
+			get {
+				return eventRef;
+			}
+			set {
+				eventRef = value;
+			}
+		}
+
+		public CodeExpression Listener {
+			get {
+				return listener; 
+			}
+			set {
+				listener = value;
+			}
+		}
+	}
+}
+

+ 52 - 0
mcs/class/System/System.CodeDom/CodeSnippetCompileUnit.cs

@@ -0,0 +1,52 @@
+//
+// System.CodeDom CodeSnippetCompileUnit Class implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeSnippetCompileUnit
+		: CodeCompileUnit
+	{
+		private CodeLinePragma linePragma;
+		private string value;
+
+		//
+		// Constructors
+		//
+		public CodeSnippetCompileUnit( string value )
+		{
+			this.value = value;
+		}
+
+		//
+		// Properties
+		//
+		public CodeLinePragma LinePragma {
+			get {
+				return linePragma;
+			}
+			set {
+				linePragma = value;
+			}
+		}
+
+		public string Value {
+			get {
+				return this.value;
+			}
+			set {
+				this.value = value;
+			}
+		}
+	}
+}

+ 46 - 0
mcs/class/System/System.CodeDom/CodeSnippetExpression.cs

@@ -0,0 +1,46 @@
+//
+// System.CodeDom CodeSnippetExpression Class implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeSnippetExpression
+		: CodeExpression 
+	{
+		private string value;
+
+		//
+		// Constructors
+		//
+		public CodeSnippetExpression()
+		{
+		}
+
+		public CodeSnippetExpression( string value )
+		{
+			Value = value;
+		}
+		
+		//
+		// Properties
+		//
+		public string Value {
+			get {
+				return this.value;
+			}
+			set {
+				this.value = value;
+			}
+		}
+	}
+}

+ 46 - 0
mcs/class/System/System.CodeDom/CodeSnippetStatement.cs

@@ -0,0 +1,46 @@
+//
+// System.CodeDom CodeSnippetStatement Class implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeSnippetStatement
+		: CodeStatement 
+	{
+		private string value;
+
+		//
+		// Constructors
+		//
+		public CodeSnippetStatement()
+		{
+		}
+
+		public CodeSnippetStatement( string value )
+		{
+			this.value = value;
+		}
+		
+		//
+		// Properties
+		//
+		public string Value {
+			get {
+				return this.value;
+			}
+			set {
+				this.value = value;
+			}
+		}
+	}
+}

+ 46 - 0
mcs/class/System/System.CodeDom/CodeSnippetTypeMember.cs

@@ -0,0 +1,46 @@
+//
+// System.CodeDom CodeSnippetTypeMember Class implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeSnippetTypeMember
+		: CodeTypeMember
+	{
+		private string text;
+
+		//
+		// Constructors
+		//
+		public CodeSnippetTypeMember()
+		{
+		}
+		
+		public CodeSnippetTypeMember( string text )
+		{
+			this.text = text;
+		}
+
+		//
+		// Properties
+		//
+		public string Text {
+			get {
+				return text;
+			}
+			set {
+				text = value;
+			}
+		}
+	}
+}

+ 27 - 1
mcs/class/System/System.CodeDom/CodeStatement.cs

@@ -3,14 +3,40 @@
 //
 // Author:
 //   Sean MacIsaac ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
+using System.Runtime.InteropServices;
+
 namespace System.CodeDom
 {
 	[Serializable]
-	public class CodeStatement : CodeObject
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeStatement
+		: CodeObject
 	{
+		private CodeLinePragma linePragma;
+		
+		//
+		// Constructors
+		//
+		public CodeStatement()
+		{
+		}
+		
+		//
+		// Properties
+		//
+		public CodeLinePragma LinePragma {
+			get {
+				return linePragma;
+			}
+			set {
+				linePragma = value;
+			}
+		}
 	}
 }

+ 48 - 114
mcs/class/System/System.CodeDom/CodeStatementCollection.cs

@@ -3,164 +3,98 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
+using System.Collections;
 
-	using System.Collections;
-	
+namespace System.CodeDom 
+{
 	[Serializable]
-	public class CodeStatementCollection : IList, ICollection, IEnumerable {
-
-		ArrayList statements;
-		
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeStatementCollection
+		: CollectionBase
+	{
 		//
 		// Constructors
 		//
-		public CodeStatementCollection ()
+		public CodeStatementCollection()
 		{
-			statements = new ArrayList ();
 		}
 
-		//
-		// Properties
-		//
-		public int Count {
-			get {
-				return statements.Count;
-			}
-		}
-
-                public bool IsFixedSize {
-                        get {
-                                return true;
-                        }
-                }
-
-		//
-		// Methods
-		//
-		public void Add (CodeStatement value)
+		public CodeStatementCollection( CodeStatement[] value )
 		{
-			statements.Add (value);
+			AddRange( value );
 		}
 
-		public void AddRange (CodeStatement [] values)
+		public CodeStatementCollection( CodeStatementCollection value )
 		{
-			foreach (CodeStatement ca in values) 
-				statements.Add (ca);
-
+			AddRange( value );
 		}
 
-		public void Clear ()
+		//
+		// Properties
+		//
+		public CodeStatement this[int index]
 		{
-			statements.Clear ();
-		}
-
-		private class Enumerator : IEnumerator {
-			private CodeStatementCollection collection;
-			private int currentIndex = -1;
-
-			internal Enumerator (CodeStatementCollection collection)
-			{
-				this.collection = collection;
-			}
-
-			public object Current {
-				get {
-					if (currentIndex == collection.Count)
-						throw new InvalidOperationException ();
-					return collection [currentIndex];
-				}
-			}
-
-			public bool MoveNext ()
-			{
-				if (currentIndex > collection.Count)
-					throw new InvalidOperationException ();
-				return ++currentIndex < collection.Count;
+			get {
+				return (CodeStatement)List[index];
 			}
-
-			public void Reset ()
-			{
-				currentIndex = -1;
+			set {
+				List[index] = value;
 			}
 		}
-		
-		public IEnumerator GetEnumerator ()
-		{
-			return new CodeStatementCollection.Enumerator (this);
-		}
 
 		//
-		// IList method implementations
+		// Methods
 		//
-		public int Add (object value)
+		public void Add (CodeStatement value)
 		{
-			return statements.Add (value);
+			List.Add( value );
 		}
 
-		public bool Contains (Object value)
+		public void AddRange (CodeStatement [] value )
 		{
-			return statements.Contains (value);
+			foreach ( CodeStatement elem in value )
+				Add( elem );
 		}
-
-		public int IndexOf (Object value)
+		
+		public void AddRange (CodeStatementCollection value)
 		{
-			return statements.IndexOf (value);
+			foreach ( CodeStatement elem in value )
+				Add( elem );
 		}
 
-		public void Insert (int index, Object value)
+		public bool Contains( CodeStatement value )
 		{
-			statements [index] = value;
-		}
-
-		public object this[int index] {
-			get {
-				return statements [index];
-			}
-
-			set {
-				statements [index] = value;
-			}
+			return List.Contains( value );
 		}
-
-		public void Remove (object value)
+		
+		public void CopyTo( CodeStatement[] array, int index )
 		{
-			statements.Remove (value);
+			List.CopyTo( array, index );
 		}
 
-		public void RemoveAt (int index)
+		public int IndexOf( CodeStatement value )
 		{
-			statements.RemoveAt (index);
+			return List.IndexOf( value );
 		}
 
-		//
-		// ICollection method implementations
-		//
-		public void CopyTo (Array array, int index)
+		public void Insert( int index, CodeStatement value )
 		{
-			statements.CopyTo (array, index);
-		}
-
-		public object SyncRoot {
-			get {
-				return statements.SyncRoot;
-			}
+			List.Insert( index, value );
 		}
 
-		public bool IsReadOnly {
-			get {
-				return false;
-			}
-		}
-
-		public bool IsSynchronized {
-			get {
-				return statements.IsSynchronized;
-			}
+		public void Remove( CodeStatement value )
+		{
+			int index = IndexOf( value );
+			if ( index < 0 )
+				throw( new ArgumentException( "The specified object is not found in the collection" ) );
+			RemoveAt( index );
 		}
 	}
 }

+ 15 - 4
mcs/class/System/System.CodeDom/CodeThisReferenceExpression.cs

@@ -7,11 +7,22 @@
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom
+{
 	[Serializable]
-	public class CodeThisReferenceExpression : CodeExpression {
-		public CodeThisReferenceExpression () { }
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeThisReferenceExpression
+		: CodeExpression 
+	{
+
+		//
+		// Constructors
+		//
+		public CodeThisReferenceExpression()
+		{
+		}
 	}
 }
-			

+ 19 - 5
mcs/class/System/System.CodeDom/CodeThrowExceptionStatement.cs

@@ -7,23 +7,37 @@
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom
+{
 	[Serializable]
-	public class CodeThrowExceptionStatement : CodeStatement {
-		CodeExpression toThrow;
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeThrowExceptionStatement
+		: CodeStatement 
+	{
+		private CodeExpression toThrow;
 		
-		public CodeThrowExceptionStatement () {}
+		//
+		// Constructors
+		//
+		public CodeThrowExceptionStatement ()
+		{
+		}
+
 		public CodeThrowExceptionStatement (CodeExpression toThrow)
 		{
 			this.toThrow = toThrow;
 		}
 
+		//
+		// Properties
+		//
 		public CodeExpression ToThrow {
 			get {
 				return toThrow;
 			}
-
 			set {
 				toThrow = value;
 			}

+ 34 - 32
mcs/class/System/System.CodeDom/CodeTryCatchFinallyStatement.cs

@@ -3,69 +3,71 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom
+{
 	[Serializable]
-	public class CodeTryCatchFinallyStatement : CodeStatement {
-		CodeStatementCollection tryStatements, finallyStatements;
-		CodeCatchClauseCollection catchClauses;
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeTryCatchFinallyStatement
+		: CodeStatement 
+	{
+		private CodeStatementCollection tryStatements, finallyStatements;
+		private CodeCatchClauseCollection catchClauses;
 		
-		public CodeTryCatchFinallyStatement () {}
+		//
+		// Constructors
+		//
+		public CodeTryCatchFinallyStatement ()
+		{
+		}
 		
-		public CodeTryCatchFinallyStatement (CodeStatement []   tryStatements,
+		public CodeTryCatchFinallyStatement (CodeStatement [] tryStatements,
 						     CodeCatchClause [] catchClauses)
 		{
-			this.tryStatements = new CodeStatementCollection ();
-			this.catchClauses = new CodeCatchClauseCollection ();
-
-			this.tryStatements.AddRange (tryStatements);
-			this.catchClauses.AddRange (catchClauses);
+			TryStatements.AddRange( tryStatements );
+			CatchClauses.AddRange( catchClauses );
 		}
 
-		public CodeTryCatchFinallyStatement (CodeStatement []   tryStatements,
+		public CodeTryCatchFinallyStatement (CodeStatement [] tryStatements,
 						     CodeCatchClause [] catchClauses,
-						     CodeStatement []   finallyStatements)
+						     CodeStatement [] finallyStatements)
 		{
-			this.tryStatements = new CodeStatementCollection ();
-			this.catchClauses = new CodeCatchClauseCollection ();
-			this.finallyStatements = new CodeStatementCollection ();
-
-			this.tryStatements.AddRange (tryStatements);
-			this.catchClauses.AddRange (catchClauses);
-			this.finallyStatements.AddRange (finallyStatements);
+			TryStatements.AddRange( tryStatements );
+			CatchClauses.AddRange( catchClauses );
+			FinallyStatements.AddRange( finallyStatements );
 		}
 
+		//
+		// Properties
+		//
 		public CodeStatementCollection FinallyStatements{
 			get {
+				if ( finallyStatements == null )
+					finallyStatements = new CodeStatementCollection();
 				return finallyStatements;
 			}
-
-			set {
-				finallyStatements = value;
-			}
 		}
 
 		public CodeStatementCollection TryStatements {
 			get {
+				if ( tryStatements == null )
+					tryStatements = new CodeStatementCollection();
 				return tryStatements;
 			}
-
-			set {
-				tryStatements = value;
-			}
 		}
 		public CodeCatchClauseCollection CatchClauses {
 			get {
+				if ( catchClauses == null )
+					catchClauses = new CodeCatchClauseCollection();
 				return catchClauses;
 			}
-
-			set {
-				catchClauses = value;
-			}
 		}
 	}
 }

+ 21 - 0
mcs/class/System/System.CodeDom/CodeTypeConstructor.cs

@@ -0,0 +1,21 @@
+//
+// System.CodeDom CodeTypeConstructor Class Implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//   
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeType
+		: CodeMemberMethod
+	{
+	}
+}

+ 91 - 1
mcs/class/System/System.CodeDom/CodeTypeDeclaration.cs

@@ -3,14 +3,104 @@
 //
 // Author:
 //   Sean MacIsaac ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
+using System.Runtime.InteropServices;
+
 namespace System.CodeDom
 {
 	[Serializable]
-	public class CodeTypeDeclaration : CodeTypeMember
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeTypeDeclaration
+		: CodeTypeMember
 	{
+		private CodeTypeReferenceCollection baseTypes;
+		private CodeTypeMemberCollection members;
+		private bool isClass;
+		private bool isEnum;
+		private bool isInterface;
+		private bool isStruct;
+
+		//
+		// Constructors
+		//
+		public CodeTypeDeclaration()
+		{
+		}
+		
+		public CodeTypeDeclaration( string name )
+		{
+			this.Name = name;
+		}
+
+		//
+		// Properties
+		//
+		public CodeTypeReferenceCollection BaseTypes {
+			get {
+				if ( baseTypes == null ) {
+					baseTypes = new CodeTypeReferenceCollection();
+					PopulateBaseTypes( this, EventArgs.Empty );
+				}
+				return baseTypes;
+			}
+		}
+
+		public bool IsClass {
+			get {
+				return isClass;
+			}
+			set {
+				isClass = value;
+			}
+		}
+		
+		public bool IsEnum {
+			get {
+				return isEnum;
+			}
+			set {
+				isEnum = value;
+			}
+		}
+
+		public bool IsInterface {
+			get {
+				return isInterface;
+			}
+			set {
+				isInterface = value;
+			}
+		}
+
+		public bool IsStruct {
+			get {
+				return isStruct;
+			}
+			set {
+				isStruct = value;
+			}
+		}
+
+		public CodeTypeMemberCollection Members {
+			get {
+				if ( members == null ) {
+					members = new CodeTypeMemberCollection();
+					PopulateMembers( this, EventArgs.Empty );
+				}
+				return members;
+			}
+		}
+
+		//
+		// Events
+		// 
+		public event EventHandler PopulateBaseTypes;
+
+		public event EventHandler PopulateMembers;
 	}
 }

+ 99 - 0
mcs/class/System/System.CodeDom/CodeTypeDeclarationCollection.cs

@@ -0,0 +1,99 @@
+//
+// System.CodeDom CodeTypeDeclarationCollection Class implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+using System.Collections;
+
+namespace System.CodeDom 
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeTypeDeclarationCollection 
+		: CollectionBase
+	{
+		//
+		// Constructors
+		//
+		public CodeTypeDeclarationCollection()
+		{
+		}
+
+		public CodeTypeDeclarationCollection( CodeTypeDeclaration[] value )
+		{
+			AddRange( value );
+		}
+
+		public CodeTypeDeclarationCollection( CodeTypeDeclarationCollection value )
+		{
+			AddRange( value );
+		}
+
+		//
+		// Properties
+		//
+		public CodeTypeDeclaration this[int index]
+		{
+			get {
+				return (CodeTypeDeclaration)List[index];
+			}
+			set {
+				List[index] = value;
+			}
+		}
+
+		//
+		// Methods
+		//
+		public void Add (CodeTypeDeclaration value)
+		{
+			List.Add (value);
+		}
+
+		public void AddRange (CodeTypeDeclaration [] value)
+		{
+			foreach (CodeTypeDeclaration ca in value) 
+				Add( ca );
+		}
+
+		public void AddRange (CodeTypeDeclarationCollection value)
+		{
+			foreach (CodeTypeDeclaration ca in value) 
+				Add( ca );
+		}
+
+		public bool Contains( CodeTypeDeclaration value )
+		{
+			return List.Contains( value );
+		}
+
+		public void CopyTo( CodeTypeDeclaration[] array, int index )
+		{
+			List.CopyTo( array, index );
+		}
+
+		public int IndexOf( CodeTypeDeclaration value )
+		{
+			return List.IndexOf( value );
+		}
+
+		public void Insert( int index, CodeTypeDeclaration value )
+		{
+			List.Insert( index, value );
+		}
+
+		public void Remove( CodeTypeDeclaration value )
+		{
+			int index = IndexOf( value );
+			if ( index < 0 )
+				throw( new ArgumentException( "The specified object is not found in the collection" ) );
+			RemoveAt( index );
+		}
+	}
+}

+ 56 - 0
mcs/class/System/System.CodeDom/CodeTypeDelegate.cs

@@ -0,0 +1,56 @@
+//
+// System.CodeDom CodeTypeDelegate Class implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeTypeDelegate
+		: CodeTypeDeclaration
+	{
+		private	CodeParameterDeclarationExpressionCollection parameters;
+		private CodeTypeReference returnType;
+
+		//
+		// Constructors
+		//
+		public CodeTypeDelegate()
+		{
+		}
+
+		public CodeTypeDelegate( string name )
+		{
+			this.Name = name;
+		}
+
+		//
+		// Properties
+		//
+		public CodeParameterDeclarationExpressionCollection Parameters {
+			get {
+				if ( parameters == null )
+					parameters = new CodeParameterDeclarationExpressionCollection();
+				return parameters;
+			}
+		}
+
+		public CodeTypeReference ReturnType {
+			get {
+				return returnType;
+			}
+			set {
+				returnType = value;
+			}
+		}
+	}
+}
+

+ 57 - 1
mcs/class/System/System.CodeDom/CodeTypeMember.cs

@@ -3,15 +3,71 @@
 //
 // Author:
 //   Sean MacIsaac ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
+using System.Runtime.InteropServices;
+
 namespace System.CodeDom
 {
 	[Serializable]
-	public class CodeTypeMember : CodeObject {
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeTypeMember
+		: CodeObject
+	{
 		private string name;
+		private MemberAttributes attributes;
+		private CodeCommentStatementCollection comments;
+		private CodeAttributeDeclarationCollection customAttributes;
+		private CodeLinePragma linePragma;
+
+		//
+		// Constructors
+		//
+		public CodeTypeMember()
+		{
+		}
+		
+		//
+		// Properties
+		//
+		public MemberAttributes Attributes {
+			get {
+				return attributes;
+			}
+			set {
+				attributes = value;
+			}
+		}
+
+		public CodeCommentStatementCollection Comments {
+			get {
+				if ( comments == null )
+					comments = new CodeCommentStatementCollection();
+				return comments;
+			}
+		}
+
+		
+		public CodeAttributeDeclarationCollection CustomAttributes {
+			get {
+				if ( customAttributes == null )
+					customAttributes = new CodeAttributeDeclarationCollection();
+				return customAttributes;
+			}
+		}
+
+		public CodeLinePragma LinePragma {
+			get {
+				return linePragma;
+			}
+			set {
+				linePragma = value;
+			}
+		}
 
 		public string Name {
 			get {

+ 99 - 0
mcs/class/System/System.CodeDom/CodeTypeMemberCollection.cs

@@ -0,0 +1,99 @@
+//
+// System.CodeDom CodeTypeMemberCollection Class implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+using System.Collections;
+
+namespace System.CodeDom 
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeTypeMemberCollection
+		: CollectionBase
+	{
+		//
+		// Constructors
+		//
+		public CodeTypeMemberCollection()
+		{
+		}
+		
+		public CodeTypeMemberCollection( CodeTypeMember[] value )
+		{
+			AddRange( value );
+		}
+
+		public CodeTypeMemberCollection( CodeTypeMemberCollection value )
+		{
+			AddRange( value );
+		}
+
+		//
+		// Properties
+		//
+		public CodeTypeMember this[int index]
+		{
+			get {
+				return (CodeTypeMember)List[index];
+			}
+			set {
+				List[index] = value;
+			}
+		}
+
+		//
+		// Methods
+		//
+		public void Add (CodeTypeMember value)
+		{
+			List.Add( value );
+		}
+
+		public void AddRange (CodeTypeMember [] value )
+		{
+			foreach ( CodeTypeMember elem in value )
+				Add( elem );
+		}
+		
+		public void AddRange (CodeTypeMemberCollection value)
+		{
+			foreach ( CodeTypeMember elem in value )
+				Add( elem );
+		}
+
+		public bool Contains( CodeTypeMember value )
+		{
+			return List.Contains( value );
+		}
+		
+		public void CopyTo( CodeTypeMember[] array, int index )
+		{
+			List.CopyTo( array, index );
+		}
+
+		public int IndexOf( CodeTypeMember value )
+		{
+			return List.IndexOf( value );
+		}
+
+		public void Insert( int index, CodeTypeMember value )
+		{
+			List.Insert( index, value );
+		}
+
+		public void Remove( CodeTypeMember value )
+		{
+			int index = IndexOf( value );
+			if ( index < 0 )
+				throw( new ArgumentException( "The specified object is not found in the collection" ) );
+			RemoveAt( index );
+		}
+	}
+}

+ 31 - 7
mcs/class/System/System.CodeDom/CodeTypeOfExpression.cs

@@ -3,28 +3,52 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom
+{
 	[Serializable]
-	public class CodeTypeOfExpression : CodeExpression {
-		string type;
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeTypeOfExpression
+		: CodeExpression 
+	{
+		private CodeTypeReference type;
 			
-		public CodeTypeOfExpression () {}
+		//
+		// Constructors
+		//
+		public CodeTypeOfExpression () 
+		{
+		}
 
-		public CodeTypeOfExpression (string type)
+		public CodeTypeOfExpression (CodeTypeReference type)
 		{
 			this.type = type;
 		}
 
-		public string Type {
+		public CodeTypeOfExpression (string type)
+		{
+			this.type = new CodeTypeReference( type );
+		}
+		
+		public CodeTypeOfExpression (Type type)
+		{
+			this.type = new CodeTypeReference( type );
+		}
+
+		//
+		// Properties
+		//
+		public CodeTypeReference Type {
 			get {
 				return type;
 			}
-
 			set {
 				type = value;
 			}

+ 76 - 0
mcs/class/System/System.CodeDom/CodeTypeReference.cs

@@ -0,0 +1,76 @@
+//
+// System.CodeDom CodeTypeReferenceExpression Class implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeTypeReference
+		: CodeObject
+	{
+		private string baseType;
+		private CodeTypeReference elementType;
+		private int rank;
+
+		//
+		// Constructors
+		//
+		public CodeTypeReference( string baseType )
+		{
+			this.baseType = baseType;
+		}
+		
+		public CodeTypeReference( Type baseType )
+		{
+			this.baseType = baseType.FullName;
+		}
+
+		// FIXME: probably broken
+		public CodeTypeReference( CodeTypeReference baseType, int rank )
+		{
+			this.baseType = typeof(System.Array).Name;
+			this.rank = rank;
+		}
+
+		// FIXME: probably broken
+		public CodeTypeReference( string baseType, int rank )
+		{
+			this.baseType = baseType;
+			this.rank = rank;
+		}
+			
+
+		//
+		// Properties
+		//
+		// FIXME: probably broken
+		public CodeTypeReference ArrayElementType
+		{
+			get {
+				return elementType;;
+			}
+			set {
+				elementType = value;
+			}
+		}
+		
+		// FIXME: probably broken
+		public int ArrayRank {
+			get {
+				return rank;
+			}
+			set {
+				rank = value;
+			}
+		}
+	}
+}

+ 99 - 0
mcs/class/System/System.CodeDom/CodeTypeReferenceCollection.cs

@@ -0,0 +1,99 @@
+//
+// System.CodeDom CodeTypeReferenceCollection Class implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+using System.Collections;
+
+namespace System.CodeDom 
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeTypeReferenceCollection
+		: CollectionBase
+	{
+		//
+		// Constructors
+		//
+		public CodeTypeReferenceCollection()
+		{
+		}
+
+		public CodeTypeReferenceCollection( CodeTypeReference[] value )
+		{
+			AddRange( value );
+		}
+
+		public CodeTypeReferenceCollection( CodeTypeReferenceCollection value )
+		{
+			AddRange( value );
+		}
+
+		//
+		// Properties
+		//
+		public CodeTypeReference this[int index]
+		{
+			get {
+				return (CodeTypeReference)List[index];
+			}
+			set {
+				List[index] = value;
+			}
+		}
+
+		//
+		// Methods
+		//
+		public void Add (CodeTypeReference value)
+		{
+			List.Add( value );
+		}
+
+		public void AddRange (CodeTypeReference [] value )
+		{
+			foreach ( CodeTypeReference elem in value )
+				Add( elem );
+		}
+		
+		public void AddRange (CodeTypeReferenceCollection value)
+		{
+			foreach ( CodeTypeReference elem in value )
+				Add( elem );
+		}
+
+		public bool Contains( CodeTypeReference value )
+		{
+			return List.Contains( value );
+		}
+		
+		public void CopyTo( CodeTypeReference[] array, int index )
+		{
+			List.CopyTo( array, index );
+		}
+
+		public int IndexOf( CodeTypeReference value )
+		{
+			return List.IndexOf( value );
+		}
+
+		public void Insert( int index, CodeTypeReference value )
+		{
+			List.Insert( index, value );
+		}
+
+		public void Remove( CodeTypeReference value )
+		{
+			int index = IndexOf( value );
+			if ( index < 0 )
+				throw( new ArgumentException( "The specified object is not found in the collection" ) );
+			RemoveAt( index );
+		}
+	}
+}

+ 31 - 7
mcs/class/System/System.CodeDom/CodeTypeReferenceExpression.cs

@@ -3,28 +3,52 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom
+{
 	[Serializable]
-	public class CodeTypeReferenceExpression : CodeExpression {
-		string type;
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeTypeReferenceExpression
+		: CodeExpression
+	{
+		private CodeTypeReference type;
 		
-		public CodeTypeReferenceExpression () {}
+		//
+		// Constructors
+		//
+		public CodeTypeReferenceExpression ()
+		{
+		}
 
-		public CodeTypeReferenceExpression (string type)
+		public CodeTypeReferenceExpression (CodeTypeReference type)
 		{
 			this.type = type;
 		}
+		
+		public CodeTypeReferenceExpression (string type)
+		{
+			this.type = new CodeTypeReference( type );
+		}
 
-		public string Type {
+		public CodeTypeReferenceExpression (Type type)
+		{
+			this.type = new CodeTypeReference( type );
+		}
+
+		//
+		// Properties
+		//
+		public CodeTypeReference Type {
 			get {
 				return type;
 			}
-
 			set {
 				type = value;
 			}

+ 57 - 12
mcs/class/System/System.CodeDom/CodeVariableDeclarationStatement.cs

@@ -3,38 +3,85 @@
 //
 // Author:
 //   Miguel de Icaza ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
-namespace System.CodeDom {
+using System.Runtime.InteropServices;
 
+namespace System.CodeDom 
+{
 	[Serializable]
-	public class CodeVariableDeclarationStatement : CodeStatement  {
-		CodeExpression initExpression;
-		string type, name;
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeVariableDeclarationStatement
+		: CodeStatement  
+	{
+		private CodeExpression initExpression;
+		private CodeTypeReference type;
+		private string name;
 
-		public CodeVariableDeclarationStatement () {}
+		//
+		// Constructors
+		//
+		public CodeVariableDeclarationStatement () 
+		{
+		}
 
-		public CodeVariableDeclarationStatement (string type, string name)
+		public CodeVariableDeclarationStatement( CodeTypeReference type, string name )
 		{
 			this.type = type;
 			this.name = name;
 		}
+		
+		public CodeVariableDeclarationStatement( string type, string name )
+		{
+			this.type = new CodeTypeReference( type );
+			this.name = name;
+		}
 
-		public CodeVariableDeclarationStatement (string type, string name,
-							 CodeExpression initExpression)
+		public CodeVariableDeclarationStatement( Type type, string name )
+		{
+			this.type = new CodeTypeReference( type );
+			this.name = name;
+		}
+
+		public CodeVariableDeclarationStatement( CodeTypeReference type, 
+							 string name,
+							 CodeExpression initExpression )
 		{
 			this.type = type;
 			this.name = name;
 			this.initExpression = initExpression;
 		}
 
+		public CodeVariableDeclarationStatement( string type,
+							 string name, 
+							 CodeExpression initExpression )
+		{
+			this.type = new CodeTypeReference( type );
+			this.name = name;
+			this.initExpression = initExpression;
+		}
+
+		public CodeVariableDeclarationStatement( Type type, 
+							 string name, 
+							 CodeExpression initExpression )
+		{
+			this.type = new CodeTypeReference( type );
+			this.name = name;
+			this.initExpression = initExpression;
+		}
+
+
+		//
+		// Properties
+		//
 		public CodeExpression InitExpression {
 			get {
 				return initExpression;
 			}
-
 			set {
 				initExpression = value;
 			}
@@ -44,17 +91,15 @@ namespace System.CodeDom {
 			get {
 				return name;
 			}
-			
 			set {
 				name = value;
 			}
 		}
 
-		public string Type {
+		public CodeTypeReference Type {
 			get {
 				return type;
 			}
-
 			set {
 				type = value;
 			}

+ 46 - 0
mcs/class/System/System.CodeDom/CodeVariableReferenceExpression.cs

@@ -0,0 +1,46 @@
+//
+// System.CodeDom CodeVariableReferenceExpression Class implementation
+//
+// Author:
+//   Daniel Stodden ([email protected])
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.CodeDom
+{
+	[Serializable]
+	[ClassInterface(ClassInterfaceType.AutoDispatch)]
+	[ComVisible(true)]
+	public class CodeVariableReferenceExpression
+		: CodeExpression 
+	{
+		private string variableName;
+
+		//
+		// Constructors
+		//
+		public CodeVariableReferenceExpression() 
+		{
+		}
+
+		public CodeVariableReferenceExpression( string variableName )
+		{
+			this.variableName = variableName;
+		}
+
+		//
+		// Properties
+		//
+		public string VariableName {
+			get {
+				return variableName;
+			}
+			set {
+				variableName = value;
+			}
+		}
+	}
+}

+ 8 - 1
mcs/class/System/System.CodeDom/FieldDirection.cs

@@ -7,8 +7,15 @@
 // (C) 2001 Ximian, Inc.
 //
 
+using System.Runtime.InteropServices;
+
 namespace System.CodeDom {
+
+	[Serializable]
+	[ComVisible(true)]
 	public enum FieldDirection {
-		In, Out, Ref
+		In,
+		Out,
+		Ref
 	}
 }

+ 24 - 16
mcs/class/System/System.CodeDom/MemberAttributes.cs

@@ -3,28 +3,36 @@
 //
 // Author:
 //   Sean MacIsaac ([email protected])
+//   Daniel Stodden ([email protected])
 //
 // (C) 2001 Ximian, Inc.
 //
 
+using System.Runtime.InteropServices;
+
 namespace System.CodeDom {
+
+	[Serializable]
+	[ComVisible(true)]
 	public enum MemberAttributes {
-		Abstract = 0x1,
-		Final,
-		Static,
-		Override,
-		Const,
-		New = 0x10,
-		Overloaded = 0x100,
-		Assembly = 0x1000,
-		FamilyAndAssembly = 0x2000,
-		Family = 0x3000,
-		FamilyOrAssembly = 0x4000,
-		Private = 0x5000,
-		Public = 0x6000,
+		Abstract =		0x00000001,
+		Final =			0x00000002,
+		Static =		0x00000003,
+		Override =		0x00000004,
+		Const =			0x00000005,
+		ScopeMask =		0x0000000F,
+
+		New =			0x00000010,
+		VTableMask =		0x000000F0,
+
+		Overloaded =		0x00000100,
 
-		ScopeMask = 0xf,
-		VTableMask = 0xf0,
-		AccessMask = 0xf000,
+		Assembly =		0x00001000, // internal
+		FamilyAndAssembly =	0x00002000,
+		Family =		0x00003000, // protected
+		FamilyOrAssembly =	0x00004000, // protected internal
+		Private =		0x00005000, // private
+		Public =		0x00006000, // public
+		AccessMask =		0x0000F000
 	}
 }