Skip to content

Commit

Permalink
[Truffle] Fix multiple assignment of constants.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisseaton committed Apr 5, 2015
1 parent 5f6f59b commit dcb1551
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,10 @@ public RubyNode visitComplexNode(ComplexNode node) {

@Override
public RubyNode visitConstDeclNode(org.jruby.ast.ConstDeclNode node) {
return visitConstDeclNode(node, node.getValueNode().accept(this));
}

private RubyNode visitConstDeclNode(org.jruby.ast.ConstDeclNode node, RubyNode rhs) {
final SourceSection sourceSection = translate(node.getPosition());

RubyNode moduleNode;
Expand All @@ -931,7 +935,7 @@ public RubyNode visitConstDeclNode(org.jruby.ast.ConstDeclNode node) {
throw new UnsupportedOperationException();
}

return new WriteConstantNode(context, sourceSection, node.getName(), moduleNode, node.getValueNode().accept(this));
return new WriteConstantNode(context, sourceSection, node.getName(), moduleNode, rhs);
}

@Override
Expand Down Expand Up @@ -2111,6 +2115,8 @@ private RubyNode translateDummyAssignment(org.jruby.ast.Node dummyAssignment, Ru
}
} else if (dummyAssignment instanceof org.jruby.ast.GlobalAsgnNode) {
return translateGlobalAsgnNode((org.jruby.ast.GlobalAsgnNode) dummyAssignment, rhs);
} else if (dummyAssignment instanceof org.jruby.ast.ConstDeclNode) {
return visitConstDeclNode((org.jruby.ast.ConstDeclNode) dummyAssignment, rhs);
} else {
translated = ((ReadNode) environment.findLocalVarNode(environment.allocateLocalTemp("dummy"), sourceSection)).makeWriteNode(rhs);
}
Expand Down

0 comments on commit dcb1551

Please sign in to comment.