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);
     }
 }
Example #2
0
        private void CreateDynMethod()
        {
            if (mhandle.Value == IntPtr.Zero)
            {
                if (ilgen == null || ilgen.ILOffset == 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);
            }
        }