Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 393e64f04fb2
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 466713609b4f
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Jun 4, 2015

  1. 1
    Copy the full SHA
    2b41e2c View commit details
  2. Copy the full SHA
    4667136 View commit details
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/racc/parser.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require_relative '../../../stdlib/racc/' + File.basename(__FILE__)
Original file line number Diff line number Diff line change
@@ -1575,7 +1575,7 @@ public RubyNode visitInstAsgnNode(org.jruby.ast.InstAsgnNode node) {
RubyNode rhs;

if (node.getValueNode() == null) {
rhs = new DeadNode(context, sourceSection, "null RHS of instance variable assignment");
rhs = new DeadNode(context, sourceSection, new Exception("null RHS of instance variable assignment"));
} else {
rhs = node.getValueNode().accept(this);
}
@@ -1768,7 +1768,7 @@ public RubyNode visitLocalAsgnNode(org.jruby.ast.LocalAsgnNode node) {
RubyNode rhs;

if (node.getValueNode() == null) {
rhs = new DeadNode(context, sourceSection, "null RHS of local variable assignment");
rhs = new DeadNode(context, sourceSection, new Exception());
} else {
if (node.getValueNode().getPosition() == InvalidSourcePosition.INSTANCE) {
parentSourceSection.push(sourceSection);
@@ -2243,7 +2243,7 @@ public RubyNode visitNextNode(org.jruby.ast.NextNode node) {
@Override
public RubyNode visitNilNode(org.jruby.ast.NilNode node) {
if (node.getPosition() == InvalidSourcePosition.INSTANCE && parentSourceSection.peek() == null) {
return new DeadNode(context, null, "nil node with no invalid source position - assumed to be implicit null");
return new DeadNode(context, null, new Exception());
}

SourceSection sourceSection = translate(node.getPosition());
@@ -2521,12 +2521,12 @@ public RubyNode visitRescueNode(org.jruby.ast.RescueNode node) {

RubyNode tryPart;

if (node.getBodyNode() != null) {
tryPart = node.getBodyNode().accept(this);
} else {
if (node.getBodyNode() == null || node.getBodyNode().getPosition() == InvalidSourcePosition.INSTANCE) {
tryPart = new DefinedWrapperNode(context, sourceSection,
new LiteralNode(context, sourceSection, context.getCoreLibrary().getNilObject()),
"nil");
} else {
tryPart = node.getBodyNode().accept(this);
}

final List<RescueNode> rescueNodes = new ArrayList<>();
@@ -2571,7 +2571,7 @@ public RubyNode visitRescueNode(org.jruby.ast.RescueNode node) {

RubyNode bodyTranslated;

if (rescueBody.getBodyNode() == null) {
if (rescueBody.getBodyNode() == null || rescueBody.getBodyNode().getPosition() == InvalidSourcePosition.INSTANCE) {
bodyTranslated = new DefinedWrapperNode(context, sourceSection,
new LiteralNode(context, sourceSection, context.getCoreLibrary().getNilObject()),
"nil");
@@ -2587,7 +2587,7 @@ public RubyNode visitRescueNode(org.jruby.ast.RescueNode node) {
} else {
RubyNode bodyNode;

if (rescueBody.getBodyNode() == null) {
if (rescueBody.getBodyNode() == null || rescueBody.getBodyNode().getPosition() == InvalidSourcePosition.INSTANCE) {
bodyNode = new DefinedWrapperNode(context, sourceSection,
new LiteralNode(context, sourceSection, context.getCoreLibrary().getNilObject()),
"nil");
@@ -2604,12 +2604,12 @@ public RubyNode visitRescueNode(org.jruby.ast.RescueNode node) {

RubyNode elsePart;

if (node.getElseNode() != null) {
elsePart = node.getElseNode().accept(this);
} else {
if (node.getElseNode() == null || node.getElseNode().getPosition() == InvalidSourcePosition.INSTANCE) {
elsePart = new DefinedWrapperNode(context, sourceSection,
new LiteralNode(context, sourceSection, context.getCoreLibrary().getNilObject()),
"nil");
} else {
elsePart = node.getElseNode().accept(this);
}

return new TryNode(context, sourceSection,
Original file line number Diff line number Diff line change
@@ -20,15 +20,15 @@
*/
public class DeadNode extends RubyNode {

private final String description;
private final Exception reason;

public DeadNode(RubyContext context, SourceSection sourceSection, String description) {
public DeadNode(RubyContext context, SourceSection sourceSection, Exception reason) {
super(context, sourceSection);
this.description = description;
this.reason = reason;
}

@Override
public Object execute(VirtualFrame frame) {
throw new UnsupportedOperationException("Dead nodes should have been pruned before execution starts: " + description);
throw new UnsupportedOperationException(reason);
}
}