Пример #1
0
		internal void fixup ()
		{
			if (((attrs & (MethodAttributes.Abstract | MethodAttributes.PinvokeImpl)) == 0) && ((iattrs & (MethodImplAttributes.Runtime | MethodImplAttributes.InternalCall)) == 0)) {
				// do not allow zero length method body on MS.NET 2.0 (and higher)
				if (((ilgen == null) || (ilgen.ILOffset == 0)) && (code == null || code.Length == 0))
					throw new InvalidOperationException (
									     String.Format ("Method '{0}.{1}' does not have a method body.",
											    DeclaringType.FullName, Name));
			}
			if (ilgen != null)
				ilgen.label_fixup (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();
            }
        }
 internal void fixup()
 {
     if (((attrs & (MethodAttributes.Abstract | MethodAttributes.PinvokeImpl)) == 0) && ((iattrs & (MethodImplAttributes.Runtime | MethodImplAttributes.InternalCall)) == 0))
     {
         if ((ilgen == null) || (ilgen.ILOffset == 0))
         {
             throw new InvalidOperationException("Method '" + Name + "' does not have a method body.");
         }
     }
     if (IsStatic &&
         ((call_conv & CallingConventions.VarArgs) != 0 ||
          (call_conv & CallingConventions.HasThis) != 0))
     {
         throw new TypeLoadException();
     }
     if (ilgen != null)
     {
         ilgen.label_fixup(this);
     }
 }
Пример #5
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);
            }
        }