|
@@ -31,6 +31,8 @@ class Reflect {
|
|
__new__(_global["Object"])
|
|
__new__(_global["Object"])
|
|
#else neko
|
|
#else neko
|
|
__dollar__new(null)
|
|
__dollar__new(null)
|
|
|
|
+ #else js
|
|
|
|
+ __new__("Object")
|
|
#else error
|
|
#else error
|
|
#end
|
|
#end
|
|
;
|
|
;
|
|
@@ -57,6 +59,8 @@ class Reflect {
|
|
}
|
|
}
|
|
#else neko
|
|
#else neko
|
|
__dollar__call(__dollar__objget(cl,__dollar__hash("new".__s)),cl,args.__a)
|
|
__dollar__call(__dollar__objget(cl,__dollar__hash("new".__s)),cl,args.__a)
|
|
|
|
+ #else js
|
|
|
|
+ __new__(cl,args[0],args[1],args[2],args[3],args[4])
|
|
#else error
|
|
#else error
|
|
#end
|
|
#end
|
|
;
|
|
;
|
|
@@ -66,6 +70,8 @@ class Reflect {
|
|
return untyped
|
|
return untyped
|
|
#if flash
|
|
#if flash
|
|
this.hasOwnProperty.call(o,field)
|
|
this.hasOwnProperty.call(o,field)
|
|
|
|
+ #else js
|
|
|
|
+ o.hasOwnProperty(field)
|
|
#else neko
|
|
#else neko
|
|
__dollar__typeof(o) == __dollar__tobject && __dollar__objfield(o,__dollar__hash(field.__s))
|
|
__dollar__typeof(o) == __dollar__tobject && __dollar__objfield(o,__dollar__hash(field.__s))
|
|
#else error
|
|
#else error
|
|
@@ -74,11 +80,18 @@ class Reflect {
|
|
}
|
|
}
|
|
|
|
|
|
public static function field( o : Dynamic, field : String ) : Dynamic {
|
|
public static function field( o : Dynamic, field : String ) : Dynamic {
|
|
- return untyped
|
|
|
|
|
|
+ untyped
|
|
#if flash
|
|
#if flash
|
|
{
|
|
{
|
|
var f = o[field];
|
|
var f = o[field];
|
|
- if( f == null && !this.hasOwnProperty(o,f) )
|
|
|
|
|
|
+ if( f == null && !this.hasOwnProperty.call(o,f) )
|
|
|
|
+ throw ("No such field : " + field);
|
|
|
|
+ return f;
|
|
|
|
+ }
|
|
|
|
+ #else js
|
|
|
|
+ {
|
|
|
|
+ var f = o[field];
|
|
|
|
+ if( f == null && !o.hasOwnProperty(f) )
|
|
throw ("No such field : " + field);
|
|
throw ("No such field : " + field);
|
|
return f;
|
|
return f;
|
|
}
|
|
}
|
|
@@ -98,21 +111,24 @@ class Reflect {
|
|
}
|
|
}
|
|
|
|
|
|
public static function setField( o : Dynamic, field : String, value : Dynamic ) : Void {
|
|
public static function setField( o : Dynamic, field : String, value : Dynamic ) : Void {
|
|
- untyped {
|
|
|
|
|
|
+ untyped
|
|
#if flash
|
|
#if flash
|
|
o[field] = value;
|
|
o[field] = value;
|
|
|
|
+ #else js
|
|
|
|
+ o[field] = value;
|
|
#else neko
|
|
#else neko
|
|
if( __dollar__typeof(o) == __dollar__tobject )
|
|
if( __dollar__typeof(o) == __dollar__tobject )
|
|
__dollar__objset(o,__dollar__hash(field.__s),value);
|
|
__dollar__objset(o,__dollar__hash(field.__s),value);
|
|
#else error
|
|
#else error
|
|
#end
|
|
#end
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public static function callMethod( o : Dynamic, func : Dynamic, args : Array<Dynamic> ) : Dynamic {
|
|
public static function callMethod( o : Dynamic, func : Dynamic, args : Array<Dynamic> ) : Dynamic {
|
|
return untyped
|
|
return untyped
|
|
#if flash
|
|
#if flash
|
|
func.apply(o,args)
|
|
func.apply(o,args)
|
|
|
|
+ #else js
|
|
|
|
+ func.apply(o,args)
|
|
#else neko
|
|
#else neko
|
|
__dollar__call(func,o,args.__a)
|
|
__dollar__call(func,o,args.__a)
|
|
#else error
|
|
#else error
|
|
@@ -124,6 +140,8 @@ class Reflect {
|
|
return untyped
|
|
return untyped
|
|
#if flash
|
|
#if flash
|
|
__keys__(o)
|
|
__keys__(o)
|
|
|
|
+ #else js
|
|
|
|
+ js.Boot.__keys(o)
|
|
#else neko
|
|
#else neko
|
|
if( __dollar__typeof(o) != __dollar__tobject )
|
|
if( __dollar__typeof(o) != __dollar__tobject )
|
|
new Array<String>();
|
|
new Array<String>();
|
|
@@ -146,6 +164,8 @@ class Reflect {
|
|
return untyped
|
|
return untyped
|
|
#if flash
|
|
#if flash
|
|
f.call == _global["Function"].call
|
|
f.call == _global["Function"].call
|
|
|
|
+ #else js
|
|
|
|
+ f.call == isFunction.call
|
|
#else neko
|
|
#else neko
|
|
__dollar__typeof(f) == __dollar__tfunction
|
|
__dollar__typeof(f) == __dollar__tfunction
|
|
#else error
|
|
#else error
|
|
@@ -156,6 +176,8 @@ class Reflect {
|
|
public static function deleteField( o : Dynamic, f : String ) {
|
|
public static function deleteField( o : Dynamic, f : String ) {
|
|
#if flash
|
|
#if flash
|
|
untyped __delete__(o,f)
|
|
untyped __delete__(o,f)
|
|
|
|
+ #else js
|
|
|
|
+ untyped delete(o[f])
|
|
#else neko
|
|
#else neko
|
|
untyped __dollar__objremove(o,f.__s)
|
|
untyped __dollar__objremove(o,f.__s)
|
|
#else error
|
|
#else error
|