Пример #1
0
        // <summary>
        //   Combines this MulticastDelegate with the (Multicast)Delegate `follow'.
        //   This does _not_ combine with Delegates. ECMA states the whole delegate
        //   thing should have better been a simple System.Delegate class.
        //   Compiler generated delegates are always MulticastDelegates.
        // </summary>
        protected sealed override Delegate CombineImpl(Delegate follow)
        {
            MulticastDelegate combined, orig, clone;

            if (this.GetType() != follow.GetType())
            {
                throw new ArgumentException(Locale.GetText("Incompatible Delegate Types. First is {0} second is {1}.", this.GetType().FullName, follow.GetType().FullName));
            }

            combined = (MulticastDelegate)follow.Clone();
            combined.SetMulticastInvoke();

            for (clone = combined, orig = ((MulticastDelegate)follow).prev; orig != null; orig = orig.prev)
            {
                clone.prev = (MulticastDelegate)orig.Clone();
                clone      = clone.prev;
            }

            clone.prev = (MulticastDelegate)this.Clone();

            for (clone = clone.prev, orig = this.prev; orig != null; orig = orig.prev)
            {
                clone.prev = (MulticastDelegate)orig.Clone();
                clone      = clone.prev;
            }

            return(combined);
        }
        /// <summary>Combines this <see cref="T:System.Delegate" /> with the specified <see cref="T:System.Delegate" /> to form a new delegate.</summary>
        /// <returns>A <see cref="T:System.Delegate" /> that is the new root of the <see cref="T:System.MulticastDelegate" /> invocation list.</returns>
        /// <param name="follow">The delegate to combine with this delegate. </param>
        /// <exception cref="T:System.MemberAccessException">Cannot create an instance of an abstract class, or this member was invoked with a late-binding mechanism. </exception>
        protected sealed override Delegate CombineImpl(Delegate follow)
        {
            if (base.GetType() != follow.GetType())
            {
                throw new ArgumentException(Locale.GetText("Incompatible Delegate Types."));
            }
            MulticastDelegate multicastDelegate = (MulticastDelegate)follow.Clone();

            multicastDelegate.SetMulticastInvoke();
            MulticastDelegate multicastDelegate2 = multicastDelegate;

            for (MulticastDelegate multicastDelegate3 = ((MulticastDelegate)follow).prev; multicastDelegate3 != null; multicastDelegate3 = multicastDelegate3.prev)
            {
                multicastDelegate2.prev = (MulticastDelegate)multicastDelegate3.Clone();
                multicastDelegate2      = multicastDelegate2.prev;
            }
            multicastDelegate2.prev = (MulticastDelegate)this.Clone();
            multicastDelegate2      = multicastDelegate2.prev;
            for (MulticastDelegate multicastDelegate3 = this.prev; multicastDelegate3 != null; multicastDelegate3 = multicastDelegate3.prev)
            {
                multicastDelegate2.prev = (MulticastDelegate)multicastDelegate3.Clone();
                multicastDelegate2      = multicastDelegate2.prev;
            }
            return(multicastDelegate);
        }
Пример #3
0
        // <summary>
        //   Combines this MulticastDelegate with the (Multicast)Delegate `follow'.
        //   This does _not_ combine with Delegates. ECMA states the whole delegate
        //   thing should have better been a simple System.Delegate class.
        //   Compiler generated delegates are always MulticastDelegates.
        // </summary>
        protected override sealed Delegate CombineImpl(Delegate follow)
        {
            MulticastDelegate combined, orig, clone;

            if (GetType() != follow.GetType())
            {
                throw new ArgumentException(Locale.GetText("Incompatible Delegate Types."));
            }

            combined = (MulticastDelegate)follow.Clone();
            //combined.SetMulticastInvoke();

            for (clone = combined, orig = ((MulticastDelegate)follow).m_prev; orig != null; orig = orig.m_prev)
            {
                clone.m_prev = (MulticastDelegate)orig.Clone();
                clone        = clone.m_prev;
            }

            clone.m_prev = (MulticastDelegate)Clone();

            for (clone = clone.m_prev, orig = m_prev; orig != null; orig = orig.m_prev)
            {
                clone.m_prev = (MulticastDelegate)orig.Clone();
                clone        = clone.m_prev;
            }

            return(combined);
        }
Пример #4
0
        protected override Delegate CloneThis()
        {
            Delegate result = base.CloneThis();

            if (next != null)
            {
                ((MulticastDelegate)result).next = (Delegate)next.Clone();
            }

            return(result);
        }
Пример #5
0
        protected override Delegate CombineImpl(Delegate follow)
        {
            MulticastDelegate result = (MulticastDelegate)this.CloneThis();
            MulticastDelegate last   = result;

            while (last.next != null)
            {
                last = (MulticastDelegate)last.next;
            }
            last.next = (Delegate)follow.Clone();

            return(result);
        }
Пример #6
0
 static public int Clone(IntPtr l)
 {
     try {
         System.Delegate self = (System.Delegate)checkSelf(l);
         var             ret  = self.Clone();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #7
0
 static int Clone(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         System.Delegate obj = (System.Delegate)ToLua.CheckObject <System.Delegate>(L, 1);
         object          o   = obj.Clone();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #8
0
    static int Clone(IntPtr L)
    {
        ToLua.CheckArgsCount(L, 1);
        System.Delegate obj = (System.Delegate)ToLua.CheckObject(L, 1, typeof(System.Delegate));
        object          o   = null;

        try
        {
            o = obj.Clone();
        }
        catch (Exception e)
        {
            return(LuaDLL.luaL_error(L, e.Message));
        }

        ToLua.Push(L, o);
        return(1);
    }
Пример #9
0
        // <summary>
        //   Combines this MulticastDelegate with the (Multicast)Delegate `follow'.
        //   This does _not_ combine with Delegates. ECMA states the whole delegate
        //   thing should have better been a simple System.Delegate class.
        //   Compiler generated delegates are always MulticastDelegates.
        // </summary>
        protected sealed override Delegate CombineImpl(Delegate follow)
        {
            MulticastDelegate combined, orig, clone;

            if (this.GetType() != follow.GetType())
            {
                throw new ArgumentException(Locale.GetText("Incompatible Delegate Types."));
            }

            combined = (MulticastDelegate)follow.Clone();
            combined.SetMulticastInvoke();

            for (clone = combined, orig = ((MulticastDelegate)follow).prev; orig != null; orig = orig.prev)
            {
                clone.prev = (MulticastDelegate)orig.Clone();
                clone      = clone.prev;
            }

            clone.prev = (MulticastDelegate)this.Clone();

            for (clone = clone.prev, orig = this.prev; orig != null; orig = orig.prev)
            {
                clone.prev = (MulticastDelegate)orig.Clone();
                clone      = clone.prev;
            }
            //
            //  Beginn Pre-JIT/-Patch Code
            //
            // IntPtr adr = combined.obj_address();
            // Console.WriteLine("CombineImpl: {0:x}",adr);
            // combined.combinedDelegate();
            //
            //  Ende Pre-JIT/-Patch Code
            //
            return(combined);
        }
		// <summary>
		//   Combines this MulticastDelegate with the (Multicast)Delegate `follow'.
		//   This does _not_ combine with Delegates. ECMA states the whole delegate
		//   thing should have better been a simple System.Delegate class.
		//   Compiler generated delegates are always MulticastDelegates.
		// </summary>
		protected sealed override Delegate CombineImpl (Delegate follow)
		{
			MulticastDelegate combined, orig, clone;

			if (this.GetType() != follow.GetType ())
				throw new ArgumentException (Locale.GetText ("Incompatible Delegate Types."));

			combined = (MulticastDelegate)follow.Clone ();
			combined.SetMulticastInvoke ();

			for (clone = combined, orig = ((MulticastDelegate)follow).prev; orig != null; orig = orig.prev) {
				
				clone.prev = (MulticastDelegate)orig.Clone ();
				clone = clone.prev;
			}

			clone.prev = (MulticastDelegate)this.Clone ();

			for (clone = clone.prev, orig = this.prev; orig != null; orig = orig.prev) {

				clone.prev = (MulticastDelegate)orig.Clone ();
				clone = clone.prev;
			}

			return combined;
		}