|
@@ -30,24 +30,37 @@ import cs.internal.Exceptions;
|
|
|
return t == Dynamic;
|
|
|
if (t == null)
|
|
|
return false;
|
|
|
- var clt:cs.system.Type = cast t;
|
|
|
+ var clt = cs.Lib.as(t, cs.system.Type);
|
|
|
if (clt == null)
|
|
|
return false;
|
|
|
- var name:String = cast clt;
|
|
|
|
|
|
- switch(name)
|
|
|
+ switch(clt.ToString())
|
|
|
{
|
|
|
case "System.Double":
|
|
|
- return untyped __cs__('v is double || v is int');
|
|
|
+ return untyped __cs__('{0} is double || {0} is int', v);
|
|
|
case "System.Int32":
|
|
|
- return untyped __cs__('haxe.lang.Runtime.isInt(v)');
|
|
|
+ return cs.internal.Runtime.isInt(v);
|
|
|
case "System.Boolean":
|
|
|
- return untyped __cs__('v is bool');
|
|
|
+ return untyped __cs__('{0} is bool', v);
|
|
|
case "System.Object":
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- return clt.IsAssignableFrom(cs.Lib.getNativeType(v));
|
|
|
+ var vt = cs.Lib.getNativeType(v);
|
|
|
+
|
|
|
+ if (clt.IsAssignableFrom(vt))
|
|
|
+ return true;
|
|
|
+
|
|
|
+ #if !erase_generics
|
|
|
+ for (iface in clt.GetInterfaces()) {
|
|
|
+ var g = cs.internal.Runtime.getGenericAttr(iface);
|
|
|
+ if (g != null && g.generic == clt) {
|
|
|
+ return iface.IsAssignableFrom(vt);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #end
|
|
|
+
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
public static function string( s : Dynamic ) : String {
|