1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Use JRuby equivalent of RubyVM.compile.

RubyVM is specific to CRuby and not supported on JRuby. This is
the equivalent operation.
This commit is contained in:
Charles Oliver Nutter 2019-07-26 13:37:11 +08:00 committed by aycabta
parent 58bb7f0ca1
commit f9f02e8216

View file

@ -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/