Exemplo n.º 1
0
        /// <summary>
        /// Read value of this constant.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public object GetValue(ScriptContext /*!*/ context)
        {
            if (ValueIsDeferred)
            {
                if (Member.GetType() == typeof(ClassConstant) && DeclaringType.GetType() == typeof(PhpTypeDesc))
                {
                    ((PhpTypeDesc)DeclaringType).EnsureThreadStaticFieldsInitialized(context);
                    return(((ClassConstant)Member).GetValue());
                }

                if (memberAttributes.GetType() == typeof(GlobalConstant))
                {
                    // TODO: initialize deferred global constant
                    return(((ClassConstant)Member).GetValue());
                }

                Debug.Fail("Uncaught constant type.");
            }

            //
            return(this.LiteralValue);
        }