internal override Object Construct(Object[] args) { if (args.Length == 0) { return(this.ConstructObject()); } Object val = args[0]; switch (Convert.GetTypeCode(val)) { case TypeCode.Empty: case TypeCode.DBNull: return(this.ConstructObject()); case TypeCode.Object: if (val is ScriptObject) { return(val); } IReflect ir = null; if (val is IReflect) { ir = (IReflect)val; } else { ir = val.GetType(); } const BindingFlags flags = BindingFlags.Public | BindingFlags.OptionalParamBinding | BindingFlags.CreateInstance; return(ir.InvokeMember(String.Empty, flags, JSBinder.ob, val, new Object[0], null, null, null)); } return(Convert.ToObject3(val, this.engine)); }
internal override Object Call(Object[] args, Object thisob) { if (args.Length == 0) { return(this.ConstructObject()); } Object val = args[0]; if (val == null || val == DBNull.Value) { return(this.Construct(args)); } else { return(Convert.ToObject3(val, this.engine)); } }