Browse Source

2009-02-23 Zoltan Varga <[email protected]>

	* ILGenerator.cs SignatureHelper.cs: Add checks for user types.

svn path=/trunk/mcs/; revision=127681
Zoltan Varga 17 years ago
parent
commit
e281a9eece

+ 4 - 0
mcs/class/corlib/System.Reflection.Emit/ChangeLog

@@ -1,3 +1,7 @@
+2009-02-23  Zoltan Varga  <[email protected]>
+
+	* ILGenerator.cs SignatureHelper.cs: Add checks for user types.
+
 2008-02-21  Jb Evain  <[email protected]>
 
 	* ModuleBuilder.cs: override GetModuleVersionId

+ 4 - 2
mcs/class/corlib/System.Reflection.Emit/ILGenerator.cs

@@ -368,7 +368,8 @@ namespace System.Reflection.Emit {
 
 			if (open_blocks.Count <= 0)
 				throw new NotSupportedException ("Not in an exception block");
-
+			if (exceptionType != null && exceptionType.IsUserType)
+				throw new NotSupportedException ("User defined subclasses of System.Type are not yet supported.");
 			if (ex_handlers [cur_block].LastClauseType () == ILExceptionBlock.FILTER_START) {
 				if (exceptionType != null)
 					throw new ArgumentException ("Do not supply an exception type for filter clause");
@@ -478,7 +479,8 @@ namespace System.Reflection.Emit {
 		{
 			if (localType == null)
 				throw new ArgumentNullException ("localType");
-
+			if (localType.IsUserType)
+				throw new NotSupportedException ("User defined subclasses of System.Type are not yet supported.");
 			LocalBuilder res = new LocalBuilder (localType, this);
 			res.is_pinned = pinned;
 			

+ 9 - 0
mcs/class/corlib/System.Reflection.Emit/SignatureHelper.cs

@@ -374,6 +374,15 @@ namespace System.Reflection.Emit {
 			if (returnType == null)
 				returnType = typeof (void);
 
+			if (returnType.IsUserType)
+				throw new NotSupportedException ("User defined subclasses of System.Type are not yet supported.");
+			if (parameters != null) {
+				for (int i = 0; i < parameters.Length; ++i)
+					if (parameters [i].IsUserType)
+						throw new NotSupportedException ("User defined subclasses of System.Type are not yet supported.");
+
+			}
+
 			SignatureHelper helper = 
 				new SignatureHelper ((ModuleBuilder)mod, SignatureHelperType.HELPER_METHOD);
 			helper.returnType = returnType;