Skip to content

Commit

Permalink
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -242,6 +242,17 @@ public RubyNode visitAliasNode(org.jruby.ast.AliasNode node) {
final DynamicObject oldName = translateNameNodeToSymbol(node.getOldName());
final DynamicObject newName = translateNameNodeToSymbol(node.getNewName());

/*
* ostruct in the stdlib defines an #allocate method to be the same as #new, but our #new calls
* #allocate with full lookup, and so this forms an infinite loop. MRI doesn't do full lookup
* for #allocate so doesn't have the same problem. MRI bug #11884 about this is to workaround
* a problem Pysch has. We'll fix that when we see it for real. For now this is the easier fix.
*/

if (newName.toString().equals("allocate") && sourceSection.getSource().getName().endsWith("/ostruct.rb")) {
return nilNode(sourceSection);
}

final RubyNode ret = ModuleNodesFactory.AliasMethodNodeFactory.create(
new RaiseIfFrozenNode(new GetDefaultDefineeNode(context, sourceSection)),
new ObjectLiteralNode(context, sourceSection, newName),

0 comments on commit 5f939b2

Please sign in to comment.