Skip to content

Commit

Permalink
[Truffle] Fail hard on unknown AST nodes.
Browse files Browse the repository at this point in the history
* Implements visitOpAsgnConstDeclNode as visitOpAsgnOrNode.
  • Loading branch information
eregon committed Nov 7, 2016
1 parent 7512988 commit ed3c459
Showing 1 changed file with 9 additions and 5 deletions.
Expand Up @@ -223,6 +223,7 @@
import org.jruby.truffle.parser.ast.NilParseNode;
import org.jruby.truffle.parser.ast.NthRefParseNode;
import org.jruby.truffle.parser.ast.OpAsgnAndParseNode;
import org.jruby.truffle.parser.ast.OpAsgnConstDeclParseNode;
import org.jruby.truffle.parser.ast.OpAsgnOrParseNode;
import org.jruby.truffle.parser.ast.OpAsgnParseNode;
import org.jruby.truffle.parser.ast.OpElementAsgnParseNode;
Expand Down Expand Up @@ -2158,7 +2159,7 @@ public RubyNode visitMultipleAsgnNode(MultipleAsgnParseNode node) {
RubyNode rhsTranslated;

if (rhs == null) {
rhsTranslated = nilNode(source, sourceSection);
throw new UnsupportedOperationException("null rhs");
} else {
rhsTranslated = rhs.accept(this);
}
Expand Down Expand Up @@ -2541,6 +2542,12 @@ public RubyNode visitOpAsgnAndNode(OpAsgnAndParseNode node) {
return addNewlineIfNeeded(node, ret);
}

@Override
public RubyNode visitOpAsgnConstDeclNode(OpAsgnConstDeclParseNode node) {
// TODO (eregon, 7 Nov. 2016): Is there any semantic difference?
return visitOpAsgnOrNode(new OpAsgnOrParseNode(node.getPosition(), node.getFirstNode(), node.getSecondNode()));
}

@Override
public RubyNode visitOpAsgnNode(OpAsgnParseNode node) {
final ISourcePosition pos = node.getPosition();
Expand Down Expand Up @@ -2903,7 +2910,6 @@ public RubyNode visitRescueNode(RescueParseNode node) {
final RescueSplatNode rescueNode = new RescueSplatNode(context, fullSourceSection, splatTranslated, bodyTranslated);
rescueNodes.add(rescueNode);
} else {
RubyNode result;
throw new UnsupportedOperationException();
}
} else {
Expand Down Expand Up @@ -3203,9 +3209,7 @@ protected RubyNode initFlipFlopStates(RubySourceSection sourceSection) {

@Override
protected RubyNode defaultVisit(ParseNode node) {
RubySourceSection sourceSection = translate(node.getPosition());
final RubyNode ret = nilNode(source, sourceSection);
return addNewlineIfNeeded(node, ret);
throw new UnsupportedOperationException(node.toString());
}

public TranslatorEnvironment getEnvironment() {
Expand Down

3 comments on commit ed3c459

@bjfish
Copy link
Contributor

@bjfish bjfish commented on ed3c459 Nov 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eregon i think this might have caused the whole MRI test suite to error:
https://travis-ci.org/jruby/jruby/jobs/173978786

The error can be seen with jt test mri

@eregon
Copy link
Member Author

@eregon eregon commented on ed3c459 Nov 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks of the notice!
Now at least we know we should fix the translator :)

@eregon
Copy link
Member Author

@eregon eregon commented on ed3c459 Nov 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in fd5b2f1.
I also made MRI tests fail the whole build if they fail since they pass now.

Please sign in to comment.