From f9f02e82166643c1e12f10ac51a0d367ee26ac31 Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Fri, 26 Jul 2019 13:37:11 +0800 Subject: Use JRuby equivalent of RubyVM.compile. RubyVM is specific to CRuby and not supported on JRuby. This is the equivalent operation. --- lib/irb/ruby-lex.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb index 99ab962ff8..fd2e122e1b 100644 --- a/lib/irb/ruby-lex.rb +++ b/lib/irb/ruby-lex.rb @@ -205,7 +205,12 @@ class RubyLex begin # check if parser error are available verbose, $VERBOSE = $VERBOSE, nil - RubyVM::InstructionSequence.compile(code) + case RUBY_ENGINE + when 'jruby' + JRuby.compile_ir(code) + else + RubyVM::InstructionSequence.compile(code) + end rescue SyntaxError => e case e.message when /unterminated (?:string|regexp) meets end of file/ -- cgit v1.2.3