Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- js.Boot.__interfLoop = function(cc,cl) {
- if(cc == null) return false;
- if(cc == cl) return true;
- var intf = cc.__interfaces__;
- if(intf != null) {
- var _g1 = 0, _g = intf.length;
- while(_g1 < _g) {
- var i = _g1++;
- var i1 = intf[i];
- if(i1 == cl || js.Boot.__interfLoop(i1,cl)) return true;
- }
- }
- return js.Boot.__interfLoop(cc.__super__,cl);
- }
- js.Boot.__instanceof = function(o,cl) {
- if(cl == null) return false;
- switch(cl) {
- case Int:
- return (o|0) === o;
- case Float:
- return typeof(o) == "number";
- case Bool:
- return typeof(o) == "boolean";
- case String:
- return typeof(o) == "string";
- case Dynamic:
- return true;
- default:
- if(o != null) {
- if(typeof(cl) == "function") {
- if(o instanceof cl) {
- if(cl == Array) return o.__enum__ == null;
- return true;
- }
- if(js.Boot.__interfLoop(o.__class__,cl)) return true;
- }
- } else return false;
- if(cl == Class && o.__name__ != null) return true;
- if(cl == Enum && o.__ename__ != null) return true;
- return o.__enum__ == cl;
- }
- }
- js.Boot.__cast = function(o,t) {
- if(js.Boot.__instanceof(o,t)) return o; else throw "Cannot cast " + Std.string(o) + " to " + Std.string(t);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement