ToTypeName() статический приватный Метод

static private ToTypeName ( IReflect ir ) : String
ir IReflect
Результат String
Пример #1
0
        protected override void HandleNoSuchMemberError()
        {
            IReflect obType = this.rootObject.InferType(null);
            Object   obVal  = null;

            if (this.rootObject is ConstantWrapper)
            {
                obVal = this.rootObject.Evaluate();
            }

            if ((obType == Typeob.Object && !this.isNonVirtual) ||
                (obType is JSObject && !((JSObject)obType).noExpando) ||
                (obType is GlobalScope && !((GlobalScope)obType).isKnownAtCompileTime))
            {
                return;
            }
            if (obType is Type)
            {
                Type t = (Type)obType;
                if (Typeob.ScriptFunction.IsAssignableFrom(t) || t == Typeob.MathObject)
                {
                    //dealing with an assigment to a member of a builtin constructor function.
                    Debug.Assert(this.fast);
                    this.memberNameContext.HandleError(JSError.OLENoPropOrMethod);
                    return;
                }
                if (Typeob.IExpando.IsAssignableFrom(t))
                {
                    return;
                }
                if (!this.fast)
                {
                    if (t == Typeob.Boolean || t == Typeob.String || Convert.IsPrimitiveNumericType(t))
                    {
                        return;
                    }
                }

                // Check to see if we couldn't get the member because it is non-static.
                if (obVal is ClassScope)
                {
                    MemberInfo[] members = ((ClassScope)obVal).GetMember(this.name, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
                    if (members.Length > 0)
                    {
                        this.memberNameContext.HandleError(JSError.NonStaticWithTypeName);
                        return;
                    }
                }
            }

            if (obVal is FunctionObject)
            {
                this.rootObject = new ConstantWrapper(((FunctionObject)obVal).name, this.rootObject.context);
                this.memberNameContext.HandleError(JSError.OLENoPropOrMethod);
                return;
            }

            // Check to see if we couldn't get the member because it is static.
            if (obType is ClassScope)
            {
                MemberInfo[] members = ((ClassScope)obType).GetMember(this.name, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
                if (members.Length > 0)
                {
                    this.memberNameContext.HandleError(JSError.StaticRequiresTypeName);
                    return;
                }
            }

            if (obVal is Type)
            {
                this.memberNameContext.HandleError(JSError.NoSuchStaticMember, Convert.ToTypeName((Type)obVal));
            }
            else if (obVal is ClassScope)
            {
                this.memberNameContext.HandleError(JSError.NoSuchStaticMember, Convert.ToTypeName((ClassScope)obVal));
            }
            else if (obVal is Namespace)
            {
                this.memberNameContext.HandleError(JSError.NoSuchType, ((Namespace)obVal).Name + "." + this.name);
            }
            else
            {
                if (obType == FunctionPrototype.ob && this.rootObject is Binding &&
                    ((Binding)this.rootObject).member is JSVariableField && ((JSVariableField)((Binding)this.rootObject).member).value is FunctionObject)
                {
                    return;
                }
                this.memberNameContext.HandleError(JSError.NoSuchMember, Convert.ToTypeName(obType));
            }
        }