Skip to content

Commit fcbbe3e

Browse files
committed
Keep pattern matching opt-in until it is complete
1 parent da03fee commit fcbbe3e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/main/java/org/truffleruby/parser/BodyTranslator.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,16 @@ public RubyNode visitCaseNode(CaseParseNode node) {
829829
public RubyNode visitCaseInNode(CaseInParseNode node) {
830830
final SourceIndexLength sourceSection = node.getPosition();
831831

832+
if (!RubyLanguage.getCurrentContext().getOptions().PATTERN_MATCHING) {
833+
final RubyContext context = RubyLanguage.getCurrentContext();
834+
throw new RaiseException(
835+
context,
836+
context.getCoreExceptions().syntaxError(
837+
"syntax error, unexpected keyword_in",
838+
currentNode,
839+
sourceSection.toSourceSection(source)));
840+
}
841+
832842
PatternMatchingTranslator translator = new PatternMatchingTranslator(language, source, parserContext,
833843
currentNode, node.getCases(), environment, this);
834844

0 commit comments

Comments
 (0)