Skip to content
Permalink
Browse files
[Truffle] Fixed infinite looping when requiring in the presence of ci…
…rcular dependencies.

I'm trading one problem for another here.  If the required file fails to load for whatever reason, we're now recording that it loaded successfully, meaning subsequents requires of the same file won't attempt to load it again.  This seems like a dubious case, but undoubtedly it'll affect someone.
  • Loading branch information
nirvdrum committed Jan 15, 2015
1 parent fcc0993 commit 34e8e1f
Showing 1 changed file with 3 additions and 1 deletion.
@@ -151,8 +151,10 @@ private boolean requireFile(String fileName, RubyNode currentNode) throws IOExce
}
}

context.loadFile(fileName, currentNode);
context.getCoreLibrary().getLoadedFeatures().slowPush(context.makeString(expandedPath));

// TODO (nirvdrum 15-Jan-15): If we fail to load, we should remove the path from the loaded features because subsequent requires of the same statement may succeed.
context.loadFile(fileName, currentNode);
}

return true;

0 comments on commit 34e8e1f

Please sign in to comment.