Skip to content

Commit

Permalink
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -67,8 +67,11 @@ public Object initializeCopy(RubyBinding self, RubyBinding from) {
@CoreMethod(names = "local_variable_get", required = 1)
public abstract static class LocalVariableGetNode extends CoreMethodArrayArgumentsNode {

private final RubySymbol dollarUnderscore;

public LocalVariableGetNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
dollarUnderscore = getContext().getSymbol("$_");
}

@Specialization(guards = {
@@ -130,16 +133,19 @@ protected ReadAbstractFrameSlotNode createReadNode(FrameSlot frameSlot) {
}

protected boolean isLastLine(RubySymbol symbol) {
return symbol.toString() == "$_";
return symbol == dollarUnderscore;
}

}

@CoreMethod(names = "local_variable_set", required = 2)
public abstract static class LocalVariableSetNode extends CoreMethodArrayArgumentsNode {

private final RubySymbol dollarUnderscore;

public LocalVariableSetNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
dollarUnderscore = getContext().getSymbol("$_");
}

@Specialization(guards = {
@@ -199,7 +205,7 @@ protected WriteAbstractFrameSlotNode createWriteNode(FrameSlot frameSlot) {
}

protected boolean isLastLine(RubySymbol symbol) {
return symbol.toString() == "$_";
return symbol == dollarUnderscore;
}
}

0 comments on commit 7dd17d2

Please sign in to comment.