There was an error while loading. Please reload this page.
1 parent 11e58e0 commit 5eb3ef3Copy full SHA for 5eb3ef3
lib/irb/ruby-lex.rb
@@ -222,11 +222,16 @@ def check_code_block(code)
222
begin # check if parser error are available
223
verbose, $VERBOSE = $VERBOSE, nil
224
case RUBY_ENGINE
225
+ when 'ruby'
226
+ self.class.compile_with_errors_suppressed(code) do |inner_code, line_no|
227
+ RubyVM::InstructionSequence.compile(inner_code, nil, nil, line_no)
228
+ end
229
when 'jruby'
230
JRuby.compile_ir(code)
231
else
- self.class.compile_with_errors_suppressed(code) do |inner_code, line_no|
- RubyVM::InstructionSequence.compile(inner_code, nil, nil, line_no)
232
+ catch(:valid) do
233
+ eval("BEGIN { throw :valid, true }\n#{code}")
234
+ false
235
end
236
237
rescue EncodingError
0 commit comments