Skip to content

Commit 099ae3f

Browse files
committed
[GR-18163] Use a more portable way to check if code is parseable in the rdoc default gem
PullRequest: truffleruby/3917
2 parents 069a9ef + d87bfbd commit 099ae3f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: lib/mri/rdoc/markup/to_html.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,10 @@ def list_end_for(list_type)
426426

427427
def parseable? text
428428
verbose, $VERBOSE = $VERBOSE, nil
429-
eval("BEGIN {return true}\n#{text}")
429+
catch(:valid) do
430+
eval("BEGIN { throw :valid, true }\n#{text}")
431+
false
432+
end
430433
rescue SyntaxError
431434
false
432435
ensure

0 commit comments

Comments
 (0)