Merge pull request #487 from mayerwin/patch-1
[mono.git] / mcs / class / corlib / System.Reflection.Emit / ConstructorBuilder.cs
index 311196b8b7d181a268f40efe34def5ed63b27d36..2391dc8be2cae1cf3696be5be1e14be8c5b007e4 100644 (file)
@@ -30,6 +30,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System;
 using System.Reflection;
 using System.Reflection.Emit;
@@ -44,6 +45,7 @@ namespace System.Reflection.Emit {
        [ComVisible (true)]
        [ComDefaultInterface (typeof (_ConstructorBuilder))]
        [ClassInterface (ClassInterfaceType.None)]
+       [StructLayout (LayoutKind.Sequential)]
        public sealed class ConstructorBuilder : ConstructorInfo, _ConstructorBuilder {
        
 #pragma warning disable 169, 414
@@ -112,7 +114,7 @@ namespace System.Reflection.Emit {
 
                public override ParameterInfo[] GetParameters ()
                {
-                       if (!type.is_created && !IsCompilerContext)
+                       if (!type.is_created)
                                throw not_created ();
 
                        return GetParametersInternal ();
@@ -138,6 +140,10 @@ namespace System.Reflection.Emit {
                        
                        return parameters.Length;
                }
+
+               internal override Type GetParameterType (int pos) {
+                       return parameters [pos];
+               }
                
                public override Object Invoke (Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
                {
@@ -245,23 +251,12 @@ namespace System.Reflection.Emit {
 
                public override object [] GetCustomAttributes (bool inherit)
                {
-                       /*
-                        * On MS.NET, this always returns not_supported, but we can't do this
-                        * since there would be no way to obtain custom attributes of 
-                        * dynamically created ctors.
-                        */
-                       if (type.is_created && IsCompilerContext)
-                               return MonoCustomAttrs.GetCustomAttributes (this, inherit);
-                       else
-                               throw not_supported ();
+                       throw not_supported ();
                }
 
                public override object [] GetCustomAttributes (Type attributeType, bool inherit)
                {
-                       if (type.is_created && IsCompilerContext)
-                               return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
-                       else
-                               throw not_supported ();
+                       throw not_supported ();
                }
 
                public ILGenerator GetILGenerator ()
@@ -375,14 +370,6 @@ namespace System.Reflection.Emit {
                        return type.get_next_table_index (obj, table, inc);
                }
 
-               private bool IsCompilerContext {
-                       get {
-                               ModuleBuilder mb = (ModuleBuilder) TypeBuilder.Module;
-                               AssemblyBuilder ab = (AssemblyBuilder) mb.Assembly;
-                               return ab.IsCompilerContext;
-                       }
-               }
-
                private void RejectIfCreated ()
                {
                        if (type.is_created)
@@ -425,3 +412,4 @@ namespace System.Reflection.Emit {
                }
        }
 }
+#endif