示例#1
0
        public static T createInstance <T>(global::System.Type cl, global::haxe.root.Array args)
        {
            unchecked
            {
                if (global::haxe.lang.Runtime.refEq(cl, typeof(string)))
                {
                    return(global::haxe.lang.Runtime.genericCast <T>(args[0]));
                }

                global::System.Type t = ((global::System.Type)(cl));
                if (t.IsInterface)
                {
                    global::System.Type cl1 = global::haxe.root.Type.resolveClass(global::haxe.root.Type.getClassName(cl));
                    t = cl1;
                }

                global::System.Reflection.ConstructorInfo[] ctors = t.GetConstructors();
                return(global::haxe.lang.Runtime.genericCast <T>(global::haxe.lang.Runtime.callMethod(default(object), ((global::System.Reflection.MethodBase[])(ctors)), (ctors as global::System.Array).Length, args)));
            }
        }
示例#2
0
        public static object createInstance(global::System.Type cl, global::haxe.root.Array args)
        {
                        #line 155 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Type.hx"
            if (global::System.Object.ReferenceEquals(((object)(cl)), ((object)(typeof(string)))))
            {
                                #line 156 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Type.hx"
                return(args.__get(0));
            }

                        #line 157 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Type.hx"
            global::System.Type t = ((global::System.Type)(cl));
            if (t.IsInterface)
            {
                                #line 160 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Type.hx"
                t = global::haxe.root.Type.resolveClass(global::haxe.root.Type.getClassName(cl));
            }

                        #line 162 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Type.hx"
            global::System.Reflection.ConstructorInfo[] ctors = t.GetConstructors();
            int      tmp = (ctors as global::System.Array).Length;
            object[] ret = new object[args.length];
            {
                                #line 163 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Type.hx"
                int _g = 0;
                                #line 163 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Type.hx"
                int _g1 = args.length;
                                #line 163 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Type.hx"
                while ((_g < _g1))
                {
                                        #line 163 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Type.hx"
                    int i = _g++;
                                        #line 163 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Type.hx"
                    ret[i] = args.__get(i);
                }
            }

                        #line 163 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\Type.hx"
            return(global::haxe.lang.Runtime.callMethod(null, ((global::System.Reflection.MethodBase[])(ctors)), tmp, ret));
        }
示例#3
0
    public static T createInstance <T>(global::System.Type cl, global::Array args)
    {
                #line 155 "/opt/haxe/std/cs/_std/Type.hx"
        if (global::System.Object.ReferenceEquals(((object)(cl)), ((object)(typeof(string)))))
        {
                        #line 156 "/opt/haxe/std/cs/_std/Type.hx"
            return(global::haxe.lang.Runtime.genericCast <T>(args[0]));
        }

                #line 157 "/opt/haxe/std/cs/_std/Type.hx"
        global::System.Type t = ((global::System.Type)(cl));
        if (t.IsInterface)
        {
                        #line 160 "/opt/haxe/std/cs/_std/Type.hx"
            t = global::Type.resolveClass(global::Type.getClassName(cl));
        }

                #line 162 "/opt/haxe/std/cs/_std/Type.hx"
        global::System.Reflection.ConstructorInfo[] ctors = t.GetConstructors();
        int      tmp = (ctors as global::System.Array).Length;
        object[] ret = new object[((int)(global::haxe.lang.Runtime.getField_f(args, "length", 520590566, true)))];
        global::cs.Lib.p_nativeArray <object>(((global::Array <object>)(global::Array <object> .__hx_cast <object>(((global::Array)(args))))), ((global::System.Array)(ret)));
        return(global::haxe.lang.Runtime.genericCast <T>(global::haxe.lang.Runtime.callMethod(null, ((global::System.Reflection.MethodBase[])(ctors)), tmp, ret)));
    }