Created
April 21, 2018 01:33
-
-
Save jgaskins/8230fbc0cd644203245be1ba40b1375b to your computer and use it in GitHub Desktop.
Optimized inheritance-tree walking for Opal Class#===
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Opal.is_a = function(object, self) { | |
if(!object.$$class) { return false } | |
var klass = object.$$class; | |
var modules = klass.$$inc, index; | |
while(klass !== Opal.BasicObject) { | |
if(klass === self) { return true } | |
for(index = 0; index < modules.length; index++) { | |
if(modules[index] === self) { return true } | |
} | |
klass = klass.$$super; | |
modules = klass.$$inc; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment