예제 #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);
        }
예제 #2
0
        public virtual IMethodVisitor StartOverrideWithSuperCall(MethodInstance superMethod)
        {
            IBytecodeBehaviorState state = State;

            NewType superType = NewType.GetType(state.CurrentType);

            if (!superType.Equals(superMethod.Owner))
            {
                throw new ArgumentException("Not a method of " + state.CurrentType + ": " + superMethod);
            }
            IMethodVisitor mg = VisitMethod(superMethod);

            mg.LoadThis();
            mg.LoadArgs();
            mg.InvokeSuper(superMethod);

            return(mg);
        }
예제 #3
0
            public override bool Equals(Object obj)
            {
                if (Object.ReferenceEquals(obj, this))
                {
                    return(true);
                }
                if (!(obj is PropertyKey))
                {
                    return(false);
                }
                PropertyKey other = (PropertyKey)obj;

                return(propertyName.Equals(other.propertyName) && (propertyType == null || other.propertyType == null || propertyType.Equals(other.propertyType)));
            }