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

Catch syntax error even if fatal

This commit is contained in:
Nobuyoshi Nakada 2019-10-23 02:05:28 +09:00
parent afab8122c3
commit 601f1fb456
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -359,6 +359,8 @@ EOT
code = code.dup.force_encoding(Encoding::UTF_8)
RubyVM::InstructionSequence.compile(code, fname, fname, line)
:ok
ensure
raise if SyntaxError === $!
end
else
def syntax_check(code, fname, line)