private void CreateDynMethod()
 {
     if (this.mhandle.Value == IntPtr.Zero)
     {
         if (this.ilgen == null || ILGenerator.Mono_GetCurrentOffset(this.ilgen) == 0)
         {
             throw new InvalidOperationException("Method '" + this.name + "' does not have a method body.");
         }
         this.ilgen.label_fixup();
         try
         {
             this.creating = true;
             if (this.refs != null)
             {
                 for (int i = 0; i < this.refs.Length; i++)
                 {
                     if (this.refs[i] is DynamicMethod)
                     {
                         DynamicMethod dynamicMethod = (DynamicMethod)this.refs[i];
                         if (!dynamicMethod.creating)
                         {
                             dynamicMethod.CreateDynMethod();
                         }
                     }
                 }
             }
         }
         finally
         {
             this.creating = false;
         }
         this.create_dynamic_method(this);
     }
 }
示例#2
0
 internal void fixup()
 {
     if (((attrs & (MethodAttributes.Abstract | MethodAttributes.PinvokeImpl)) == 0) && ((iattrs & (MethodImplAttributes.Runtime | MethodImplAttributes.InternalCall)) == 0))
     {
         if ((ilgen == null) || (ILGenerator.Mono_GetCurrentOffset(ilgen) == 0))
         {
             throw new InvalidOperationException("Method '" + Name + "' does not have a method body.");
         }
     }
     if (ilgen != null)
     {
         ilgen.label_fixup();
     }
 }
示例#3
0
        internal void fixup()
        {
            if (((attrs & (MethodAttributes.Abstract | MethodAttributes.PinvokeImpl)) == 0) && ((iattrs & (MethodImplAttributes.Runtime | MethodImplAttributes.InternalCall)) == 0))
            {
#if NET_2_0
                // do not allow zero length method body on MS.NET 2.0 (and higher)
                if (((ilgen == null) || (ILGenerator.Mono_GetCurrentOffset(ilgen) == 0)) && (code == null || code.Length == 0))
#else
                if (((ilgen == null) || (ILGenerator.Mono_GetCurrentOffset(ilgen) == 0)) && (code == null))
#endif
                { throw new InvalidOperationException(
                            String.Format("Method '{0}.{1}' does not have a method body.",
                                          DeclaringType.Name, Name)); }
            }
            if (ilgen != null)
            {
                ilgen.label_fixup();
            }
        }
示例#4
0
        private void CreateDynMethod()
        {
            if (mhandle.Value == IntPtr.Zero)
            {
                if (ilgen == null || (ILGenerator.Mono_GetCurrentOffset(ilgen) == 0))
                {
                    throw new InvalidOperationException("Method '" + name + "' does not have a method body.");
                }

                ilgen.label_fixup();

                // Have to create all DynamicMethods referenced by this one
                try {
                    // Used to avoid cycles
                    creating = true;
                    if (refs != null)
                    {
                        for (int i = 0; i < refs.Length; ++i)
                        {
                            if (refs [i] is DynamicMethod)
                            {
                                DynamicMethod m = (DynamicMethod)refs [i];
                                if (!m.creating)
                                {
                                    m.CreateDynMethod();
                                }
                            }
                        }
                    }
                } finally {
                    creating = false;
                }

                create_dynamic_method(this);
            }
        }
 internal void fixup()
 {
     if ((this.attrs & (MethodAttributes.Abstract | MethodAttributes.PinvokeImpl)) == MethodAttributes.PrivateScope && (this.iattrs & (MethodImplAttributes)4099) == MethodImplAttributes.IL && (this.ilgen == null || ILGenerator.Mono_GetCurrentOffset(this.ilgen) == 0))
     {
         throw new InvalidOperationException("Method '" + this.Name + "' does not have a method body.");
     }
     if (this.ilgen != null)
     {
         this.ilgen.label_fixup();
     }
 }