Beispiel #1
0
        public static bool typeEq(global::System.Type t1, global::System.Type t2)
        {
            if (((t1 == null) || (t2 == null)))
            {
                return(t1 == t2);
            }

            bool t1i = t1.IsInterface;

            if ((t1i != t2.IsInterface))
            {
                if (t1i)
                {
                    global::haxe.lang.GenericInterface g = global::haxe.lang.Runtime.getGenericAttr(t1);
                    if ((g != null))
                    {
                        t1 = g.generic;
                    }
                }
                else
                {
                    global::haxe.lang.GenericInterface g1 = global::haxe.lang.Runtime.getGenericAttr(t2);
                    if ((g1 != null))
                    {
                        t2 = g1.generic;
                    }
                }
            }

            if (((t1.GetGenericArguments() as global::System.Array).Length > 0))
            {
                t1 = t1.GetGenericTypeDefinition();
            }

            if (((t2.GetGenericArguments() as global::System.Array).Length > 0))
            {
                t2 = t2.GetGenericTypeDefinition();
            }

            return(global::System.Object.ReferenceEquals(((object)(t1)), ((object)(t2))));
        }
Beispiel #2
0
    public static bool @is(object v, object t)
    {
        if ((v == null))
        {
            return(global::haxe.lang.Runtime.eq(t, typeof(object)));
        }

        if ((t == null))
        {
            return(false);
        }

        global::System.Type clt = ((global::System.Type)((t as global::System.Type)));
        if (global::haxe.lang.Runtime.typeEq(clt, null))
        {
            return(false);
        }

        {
            string _g = (clt as global::System.Reflection.MemberInfo).ToString();
            switch (_g)
            {
            case "System.Boolean":
            {
                return(v is bool);
            }


            case "System.Double":
            {
                return(v is double || v is int);
            }


            case "System.Int32":
            {
                return(global::haxe.lang.Runtime.isInt(v));
            }


            case "System.Object":
            {
                return(true);
            }
            }
        }

        global::System.Type vt = v.GetType();
        if (clt.IsAssignableFrom(((global::System.Type)(vt))))
        {
            return(true);
        }

        {
            uint _g1_idx = default(uint);
            global::System.Type[] _g1_arr = clt.GetInterfaces();
            _g1_idx = ((uint)(0));
            while (((bool)((_g1_idx < (_g1_arr as global::System.Array).Length))))
            {
                global::System.Type iface            = ((global::System.Type)(_g1_arr[((int)(_g1_idx++))]));
                global::haxe.lang.GenericInterface g = global::haxe.lang.Runtime.getGenericAttr(iface);
                if (((g != null) && global::haxe.lang.Runtime.typeEq(g.generic, clt)))
                {
                    return(iface.IsAssignableFrom(((global::System.Type)(vt))));
                }
            }
        }

        return(false);
    }
Beispiel #3
0
    public static bool isOfType(object v, object t)
    {
        unchecked {
                        #line 32 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Std.hx"
            if ((v == null))
            {
                                #line 33 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Std.hx"
                return(false);
            }

                        #line 34 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Std.hx"
            if ((t == null))
            {
                                #line 35 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Std.hx"
                return(false);
            }

                        #line 36 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Std.hx"
            global::System.Type clt = (t as global::System.Type);
            if (global::haxe.lang.Runtime.typeEq(clt, null))
            {
                                #line 38 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Std.hx"
                return(false);
            }

                        #line 40 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Std.hx"
            switch ((clt as global::System.Reflection.MemberInfo).ToString())
            {
            case "System.Boolean":
            {
                                        #line 46 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Std.hx"
                return(v is bool);
            }


            case "System.Double":
            {
                                        #line 42 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Std.hx"
                return(v is double || v is int);
            }


            case "System.Int32":
            {
                                        #line 44 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Std.hx"
                return(global::haxe.lang.Runtime.isInt(v));
            }


            case "System.Object":
            {
                                        #line 48 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Std.hx"
                return(true);
            }
            }

                        #line 51 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Std.hx"
            global::System.Type vt = v.GetType();
                        #line 53 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Std.hx"
            if (clt.IsAssignableFrom(((global::System.Type)(vt))))
            {
                                #line 54 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Std.hx"
                return(true);
            }

                        #line 57 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Std.hx"
            {
                                #line 57 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Std.hx"
                global::System.Type[] _g1_arr = clt.GetInterfaces();
                                #line 57 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Std.hx"
                uint _g1_idx = ((uint)(0));
                                #line 57 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Std.hx"
                while ((_g1_idx < (_g1_arr as global::System.Array).Length))
                {
                                        #line 57 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Std.hx"
                    _g1_idx += ((uint)(1));
                                        #line 57 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Std.hx"
                    global::System.Type iface            = ((global::System.Type)(_g1_arr[((int)(((uint)((_g1_idx - 1)))))]));
                    global::haxe.lang.GenericInterface g = global::haxe.lang.Runtime.getGenericAttr(iface);
                                        #line 59 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Std.hx"
                    if (((g != null) && global::haxe.lang.Runtime.typeEq(g.generic, clt)))
                    {
                                                #line 60 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Std.hx"
                        return(iface.IsAssignableFrom(((global::System.Type)(vt))));
                    }
                }
            }

                        #line 65 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Std.hx"
            return(false);
        }
                #line default
    }
Beispiel #4
0
    public static global::System.Type resolveClass(string name)
    {
        unchecked {
                        #line 101 "/opt/haxe/std/cs/_std/Type.hx"
            global::System.Type t = global::System.Type.GetType(((string)(name)));
                        #line 103 "/opt/haxe/std/cs/_std/Type.hx"
            if (global::System.Object.ReferenceEquals(((object)(t)), default(object)))
            {
                                #line 104 "/opt/haxe/std/cs/_std/Type.hx"
                global::System.Collections.IEnumerator all = (global::System.AppDomain.CurrentDomain.GetAssemblies() as global::System.Array).GetEnumerator();
                while (all.MoveNext())
                {
                                        #line 106 "/opt/haxe/std/cs/_std/Type.hx"
                    global::System.Reflection.Assembly t2 = ((global::System.Reflection.Assembly)(all.Current));
                    t = t2.GetType(((string)(name)));
                                        #line 108 "/opt/haxe/std/cs/_std/Type.hx"
                    if (!(global::System.Object.ReferenceEquals(((object)(t)), default(object))))
                    {
                                                #line 109 "/opt/haxe/std/cs/_std/Type.hx"
                        break;
                    }
                }
            }

                        #line 113 "/opt/haxe/std/cs/_std/Type.hx"
            if (global::System.Object.ReferenceEquals(((object)(t)), default(object)))
            {
                                #line 114 "/opt/haxe/std/cs/_std/Type.hx"
                switch (name)
                {
                case "Bool":
                {
                                                #line 126 "/opt/haxe/std/cs/_std/Type.hx"
                    return((global::System.Type)(typeof(bool)));
                }


                case "Class":
                {
                                                #line 120 "/opt/haxe/std/cs/_std/Type.hx"
                    return((global::System.Type)(typeof(global::System.Type)));
                }


                case "Dynamic":
                {
                                                #line 122 "/opt/haxe/std/cs/_std/Type.hx"
                    return((global::System.Type)(typeof(object)));
                }


                case "Float":
                {
                                                #line 118 "/opt/haxe/std/cs/_std/Type.hx"
                    return((global::System.Type)(typeof(double)));
                }


                case "Int":
                {
                                                #line 116 "/opt/haxe/std/cs/_std/Type.hx"
                    return((global::System.Type)(typeof(int)));
                }


                case "String":
                {
                                                #line 124 "/opt/haxe/std/cs/_std/Type.hx"
                    return((global::System.Type)(typeof(string)));
                }


                default:
                {
                                                #line 128 "/opt/haxe/std/cs/_std/Type.hx"
                    return(null);
                }
                }
            }
            else if ((t.IsInterface && (((global::System.Type)(typeof(global::haxe.lang.IGenericObject)))).IsAssignableFrom(((global::System.Type)(t)))))
            {
                                #line 133 "/opt/haxe/std/cs/_std/Type.hx"
                {
                                        #line 133 "/opt/haxe/std/cs/_std/Type.hx"
                    object[] _g_arr = (t as global::System.Reflection.MemberInfo).GetCustomAttributes(((bool)(true)));
                                        #line 133 "/opt/haxe/std/cs/_std/Type.hx"
                    uint _g_idx = ((uint)(0));
                                        #line 133 "/opt/haxe/std/cs/_std/Type.hx"
                    while ((_g_idx < (_g_arr as global::System.Array).Length))
                    {
                                                #line 133 "/opt/haxe/std/cs/_std/Type.hx"
                        _g_idx += ((uint)(1));
                                                #line 133 "/opt/haxe/std/cs/_std/Type.hx"
                        object attr = ((object)(_g_arr[((int)(((uint)((_g_idx - 1)))))]));
                        global::haxe.lang.GenericInterface g = (((object)(attr)) as global::haxe.lang.GenericInterface);
                                                #line 135 "/opt/haxe/std/cs/_std/Type.hx"
                        if ((g != null))
                        {
                                                        #line 136 "/opt/haxe/std/cs/_std/Type.hx"
                            return((global::System.Type)(g.generic));
                        }
                    }
                }

                                #line 139 "/opt/haxe/std/cs/_std/Type.hx"
                return((global::System.Type)(t));
            }
            else
            {
                                #line 142 "/opt/haxe/std/cs/_std/Type.hx"
                return((global::System.Type)(t));
            }
        }
                #line default
    }
Beispiel #5
0
    public static global::System.Type resolveClass(string name)
    {
        global::System.Type t = global::System.Type.GetType(((string)(name)));
        if (global::haxe.lang.Runtime.typeEq(t, null))
        {
            global::System.Collections.IEnumerator all = (global::System.AppDomain.CurrentDomain.GetAssemblies() as global::System.Array).GetEnumerator();
            while (all.MoveNext())
            {
                global::System.Reflection.Assembly t2 = ((global::System.Reflection.Assembly)(all.Current));
                t = t2.GetType(((string)(name)));
                if (!(global::haxe.lang.Runtime.typeEq(t, null)))
                {
                    break;
                }
            }
        }

        if (global::haxe.lang.Runtime.typeEq(t, null))
        {
            switch (name)
            {
            case "Class":
            {
                return((global::System.Type)(typeof(global::System.Type)));
            }


            case "Dynamic":
            {
                return((global::System.Type)(typeof(object)));
            }


            case "Float":
            {
                return((global::System.Type)(typeof(double)));
            }


            case "Int":
            {
                return((global::System.Type)(typeof(int)));
            }


            case "String":
            {
                return((global::System.Type)(typeof(string)));
            }


            default:
            {
                return(null);
            }
            }
        }
        else if ((t.IsInterface && (((global::System.Type)(typeof(global::haxe.lang.IGenericObject)))).IsAssignableFrom(((global::System.Type)(t)))))
        {
            {
                uint     _g_idx = default(uint);
                object[] _g_arr = (t as global::System.Reflection.MemberInfo).GetCustomAttributes(((bool)(true)));
                _g_idx = ((uint)(0));
                while (((bool)((_g_idx < (_g_arr as global::System.Array).Length))))
                {
                    object attr = ((object)(_g_arr[((int)(_g_idx++))]));
                    global::haxe.lang.GenericInterface g = ((global::haxe.lang.GenericInterface)((attr as global::haxe.lang.GenericInterface)));
                    if ((g != null))
                    {
                        return((global::System.Type)(g.generic));
                    }
                }
            }

            return((global::System.Type)(t));
        }
        else
        {
            return((global::System.Type)(t));
        }
    }