Exemplo n.º 1
0
        public virtual void InvokeSuper(MethodInstance method)
        {
            NewType newType = BytecodeBehaviorState.State.NewType;

            if (newType.Equals(method.Owner))
            {
                // Given method is not a super method. We look in the existing class hierarchy for a method with the same signature
                if (ConstructorInstance.CONSTRUCTOR_NAME.Equals(method.Name))
                {
                    ConstructorInfo c_method = ReflectUtil.GetDeclaredConstructor(true, BytecodeBehaviorState.State.CurrentType, method.Parameters);

                    if (c_method == null)
                    {
                        throw new ArgumentException("Constructor has no super implementation: " + method);
                    }
                    method = new ConstructorInstance(c_method);
                }
                else
                {
                    MethodInfo r_method = ReflectUtil.GetDeclaredMethod(true, BytecodeBehaviorState.State.CurrentType, method.ReturnType, method.Name,
                                                                        method.Parameters);
                    if (r_method == null)
                    {
                        throw new ArgumentException("Method has no super implementation: " + method);
                    }
                    method = new MethodInstance(r_method);
                }
            }
            InvokeOnExactOwner(method);
        }