Navigation Menu

Skip to content

Commit

Permalink
[Truffle] Have a try at fixing Module.nesting.
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Oct 3, 2014
1 parent c528a96 commit bf66099
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -789,13 +789,14 @@ public RubyArray nesting() {
final List<ModuleChain> modules = new ArrayList<>();

ModuleChain module = RubyCallStack.getCallingMethod().getDeclaringModule();
RubyClass object = getContext().getCoreLibrary().getObjectClass();

while (module != null) {
while (module != null && module != object) {
if (module instanceof RubyModule) {
modules.add(module);
}

module = module.getParentModule();
module = module.getLexicalParentModule();
}

return RubyArray.fromObjects(getContext().getCoreLibrary().getArrayClass(), modules.toArray(new Object[modules.size()]));
Expand Down

0 comments on commit bf66099

Please sign in to comment.