Example #1
0
        public static void DeclareType(string phpname, RuntimeTypeHandle handle)
        {
            var info = handle.GetPhpTypeInfo();

            Debug.Assert(phpname == info.Name);
            DeclareType(info);
        }
Example #2
0
        protected override bool HasTarget => true; // there is caller instance or null as a target

        internal CallStaticMethodBinder(RuntimeTypeHandle type, string name, RuntimeTypeHandle classContext, RuntimeTypeHandle returnType)
            : base(returnType)
        {
            _type     = type.GetPhpTypeInfo();
            _name     = name;
            _classCtx = Type.GetTypeFromHandle(classContext);
        }
Example #3
0
        /// <summary>
        /// Gets <see cref="PhpTypeInfo"/> of self.
        /// Throws in case of self being used out of class context.
        /// </summary>
        public static PhpTypeInfo GetSelf(RuntimeTypeHandle self)
        {
            if (self.Equals(default(RuntimeTypeHandle)))
            {
                PhpException.ThrowSelfOutOfClass();
            }

            //
            return(self.GetPhpTypeInfo());
        }
Example #4
0
        /// <summary>
        /// Gets <see cref="PhpTypeInfo"/> of parent.
        /// Throws in case of parent being used out of class context or within a parentless class.
        /// </summary>
        public static PhpTypeInfo GetParent(RuntimeTypeHandle self)
        {
            if (self.Equals(default(RuntimeTypeHandle)))
            {
                PhpException.Throw(PhpError.Error, Resources.ErrResources.parent_used_out_of_class);
            }
            else
            {
                var t = self.GetPhpTypeInfo().BaseType;
                if (t != null)
                {
                    return(t);
                }
                else
                {
                    PhpException.Throw(PhpError.Error, Resources.ErrResources.parent_accessed_in_parentless_class);
                }
            }

            //
            throw new ArgumentException(nameof(self));
        }
Example #5
0
 /// <summary>
 /// Gets <see cref="PhpTypeInfo"/> of parent.
 /// Throws in case of parent being used out of class context or within a parentless class.
 /// </summary>
 public static PhpTypeInfo GetParent(RuntimeTypeHandle self) => GetParent(self.GetPhpTypeInfo());
Example #6
0
 /// <summary>
 /// Gets <see cref="PhpTypeInfo"/> of self or <c>null</c>.
 /// </summary>
 public static PhpTypeInfo GetSelfOrNull(RuntimeTypeHandle self) => self.GetPhpTypeInfo();