Skip to content

Commit

Permalink
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1322,6 +1322,10 @@ private void initGlobalVariableAliases() {

@Override
public RubyNode visitGlobalAsgnNode(org.jruby.ast.GlobalAsgnNode node) {
return translateGlobalAsgnNode(node, node.getValueNode().accept(this));
}

public RubyNode translateGlobalAsgnNode(org.jruby.ast.GlobalAsgnNode node, RubyNode rhs) {
final SourceSection sourceSection = translate(node.getPosition());

String name = node.getName();
@@ -1330,8 +1334,6 @@ public RubyNode visitGlobalAsgnNode(org.jruby.ast.GlobalAsgnNode node) {
name = globalVariableAliases.get(name);
}

RubyNode rhs = node.getValueNode().accept(this);

if (name.equals("$~")) {
rhs = new CheckMatchVariableTypeNode(context, sourceSection, rhs);
} else if (name.equals("$0")) {
@@ -2082,6 +2084,8 @@ private RubyNode translateDummyAssignment(org.jruby.ast.Node dummyAssignment, Ru
} else {
translated = ((ReadNode) ((WriteLocalVariableNode) dummyTranslated.getNonProxyNode()).makeReadNode()).makeWriteNode(rhs);
}
} else if (dummyAssignment instanceof org.jruby.ast.GlobalAsgnNode) {
return translateGlobalAsgnNode((org.jruby.ast.GlobalAsgnNode) dummyAssignment, rhs);
} else {
translated = ((ReadNode) environment.findLocalVarNode(environment.allocateLocalTemp("dummy"), sourceSection)).makeWriteNode(rhs);
}

0 comments on commit 0de1440

Please sign in to comment.