Call() private method

private Call ( Object args, Object thisob ) : Object
args Object
thisob Object
return Object
コード例 #1
0
ファイル: jsobject.cs プロジェクト: ydunk/masters
 internal override Object GetDefaultValue(PreferredType preferred_type)
 {
     if (preferred_type == PreferredType.String)
     {
         ScriptFunction toString = this.GetMemberValue("toString") as ScriptFunction;
         if (toString != null)
         {
             Object result = toString.Call(new Object[0], this);
             if (result == null)
             {
                 return(result);
             }
             IConvertible ic = Convert.GetIConvertible(result);
             if (ic != null && ic.GetTypeCode() != TypeCode.Object)
             {
                 return(result);
             }
         }
         ScriptFunction valueOf = this.GetMemberValue("valueOf") as ScriptFunction;
         if (valueOf != null)
         {
             Object result = valueOf.Call(new Object[0], this);
             if (result == null)
             {
                 return(result);
             }
             IConvertible ic = Convert.GetIConvertible(result);
             if (ic != null && ic.GetTypeCode() != TypeCode.Object)
             {
                 return(result);
             }
         }
     }
     else if (preferred_type == PreferredType.LocaleString)
     {
         ScriptFunction toLocaleString = this.GetMemberValue("toLocaleString") as ScriptFunction;
         if (toLocaleString != null)
         {
             return(toLocaleString.Call(new Object[0], this));
         }
     }
     else
     {
         if (preferred_type == PreferredType.Either && this is DateObject)
         {
             return(this.GetDefaultValue(PreferredType.String));
         }
         ScriptFunction valueOf = this.GetMemberValue("valueOf") as ScriptFunction;
         if (valueOf != null)
         {
             Object result = valueOf.Call(new Object[0], this);
             if (result == null)
             {
                 return(result);
             }
             IConvertible ic = Convert.GetIConvertible(result);
             if (ic != null && ic.GetTypeCode() != TypeCode.Object)
             {
                 return(result);
             }
         }
         ScriptFunction toString = this.GetMemberValue("toString") as ScriptFunction;
         if (toString != null)
         {
             Object result = toString.Call(new Object[0], this);
             if (result == null)
             {
                 return(result);
             }
             IConvertible ic = Convert.GetIConvertible(result);
             if (ic != null && ic.GetTypeCode() != TypeCode.Object)
             {
                 return(result);
             }
         }
     }
     return(this);
 }
コード例 #2
0
        internal override object GetDefaultValue(PreferredType preferred_type)
        {
            if (preferred_type == PreferredType.String)
            {
                ScriptFunction memberValue = this.GetMemberValue("toString") as ScriptFunction;
                if (memberValue != null)
                {
                    object ob = memberValue.Call(new object[0], this);
                    if (ob == null)
                    {
                        return(ob);
                    }
                    IConvertible iConvertible = Microsoft.JScript.Convert.GetIConvertible(ob);
                    if ((iConvertible != null) && (iConvertible.GetTypeCode() != TypeCode.Object))
                    {
                        return(ob);
                    }
                }
                ScriptFunction function2 = this.GetMemberValue("valueOf") as ScriptFunction;
                if (function2 != null)
                {
                    object obj3 = function2.Call(new object[0], this);
                    if (obj3 != null)
                    {
                        IConvertible convertible2 = Microsoft.JScript.Convert.GetIConvertible(obj3);
                        if ((convertible2 == null) || (convertible2.GetTypeCode() == TypeCode.Object))
                        {
                            goto Label_015D;
                        }
                    }
                    return(obj3);
                }
            }
            else if (preferred_type == PreferredType.LocaleString)
            {
                ScriptFunction function3 = this.GetMemberValue("toLocaleString") as ScriptFunction;
                if (function3 != null)
                {
                    return(function3.Call(new object[0], this));
                }
            }
            else
            {
                if ((preferred_type == PreferredType.Either) && (this is DateObject))
                {
                    return(this.GetDefaultValue(PreferredType.String));
                }
                ScriptFunction function4 = this.GetMemberValue("valueOf") as ScriptFunction;
                if (function4 != null)
                {
                    object obj4 = function4.Call(new object[0], this);
                    if (obj4 == null)
                    {
                        return(obj4);
                    }
                    IConvertible convertible3 = Microsoft.JScript.Convert.GetIConvertible(obj4);
                    if ((convertible3 != null) && (convertible3.GetTypeCode() != TypeCode.Object))
                    {
                        return(obj4);
                    }
                }
                ScriptFunction function5 = this.GetMemberValue("toString") as ScriptFunction;
                if (function5 != null)
                {
                    object obj5 = function5.Call(new object[0], this);
                    if (obj5 == null)
                    {
                        return(obj5);
                    }
                    IConvertible convertible4 = Microsoft.JScript.Convert.GetIConvertible(obj5);
                    if ((convertible4 != null) && (convertible4.GetTypeCode() != TypeCode.Object))
                    {
                        return(obj5);
                    }
                }
            }
Label_015D:
            return(this);
        }