// 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;
namespace System.Reflection.Emit {
-#if NET_2_0
[ComVisible (true)]
[ComDefaultInterface (typeof (_ConstructorBuilder))]
-#endif
[ClassInterface (ClassInterfaceType.None)]
+ [StructLayout (LayoutKind.Sequential)]
public sealed class ConstructorBuilder : ConstructorInfo, _ConstructorBuilder {
#pragma warning disable 169, 414
((ModuleBuilder) tb.Module).RegisterToken (this, GetToken ().Token);
}
-#if NET_2_0
[MonoTODO]
public override CallingConventions CallingConvention {
get {
return call_conv;
}
}
-#endif
+
public bool InitLocals {
get {
return init_locals;
public override ParameterInfo[] GetParameters ()
{
- if (!type.is_created && !IsCompilerContext)
+ if (!type.is_created)
throw not_created ();
return GetParametersInternal ();
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)
{
}
}
+#if NET_4_0
+ [Obsolete]
+#endif
public Type ReturnType {
get {
return null;
public void AddDeclarativeSecurity (SecurityAction action, PermissionSet pset)
{
+#if !NET_2_1
if (pset == null)
throw new ArgumentNullException ("pset");
if ((action == SecurityAction.RequestMinimum) ||
permissions [permissions.Length - 1] = new RefEmitPermissionSet (action, pset.ToXml ().ToString ());
attrs |= MethodAttributes.HasSecurity;
+#endif
}
public ParameterBuilder DefineParameter (int iSequence, ParameterAttributes attributes, string strParamName)
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 ()
return GetILGenerator (64);
}
-#if NET_2_0
- public
-#else
- internal
-#endif
- ILGenerator GetILGenerator (int streamSize)
+ public ILGenerator GetILGenerator (int streamSize)
{
if (ilgen != null)
return ilgen;
}
}
-#if NET_2_0
[ComVisible (true)]
-#endif
public void SetCustomAttribute (ConstructorInfo con, byte[] binaryAttribute)
{
if (con == null)
throw not_after_created ();
}
-#if NET_2_0 || BOOTSTRAP_NET_2_0
public override Module Module {
get {
return base.Module;
}
}
-#endif
public override string ToString ()
{
internal void fixup ()
{
if (((attrs & (MethodAttributes.Abstract | MethodAttributes.PinvokeImpl)) == 0) && ((iattrs & (MethodImplAttributes.Runtime | MethodImplAttributes.InternalCall)) == 0)) {
- if ((ilgen == null) || (ILGenerator.Mono_GetCurrentOffset (ilgen) == 0))
+ if ((ilgen == null) || (ilgen.ILOffset == 0))
throw new InvalidOperationException ("Method '" + Name + "' does not have a method body.");
}
if (ilgen != null)
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)
private Exception not_created ()
{
-#if NET_2_0
return new NotSupportedException ("The type is not yet created.");
-#else
- return new InvalidOperationException ("The type is not yet created.");
-#endif
}
void _ConstructorBuilder.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
}
}
}
+#endif