[ruby/prism] Assume eval context for ruby_parser and ripper

https://github.com/ruby/prism/commit/e4d6984892
This commit is contained in:
Kevin Newton 2024-05-03 08:53:24 -04:00 committed by git
parent 32b1dea566
commit 1d51e929b1
2 changed files with 7 additions and 3 deletions

View File

@ -3267,7 +3267,11 @@ module Prism
# Lazily initialize the parse result.
def result
@result ||= Prism.parse(source)
@result ||=
begin
scopes = RUBY_VERSION >= "3.3.0" ? [] : [[]]
Prism.parse(source, scopes: scopes)
end
end
##########################################################################

View File

@ -1536,13 +1536,13 @@ module Prism
# Parse the given source and translate it into the seattlerb/ruby_parser
# gem's Sexp format.
def parse(source, filepath = "(string)")
translate(Prism.parse(source, filepath: filepath), filepath)
translate(Prism.parse(source, filepath: filepath, scopes: [[]]), filepath)
end
# Parse the given file and translate it into the seattlerb/ruby_parser
# gem's Sexp format.
def parse_file(filepath)
translate(Prism.parse_file(filepath), filepath)
translate(Prism.parse_file(filepath, scopes: [[]]), filepath)
end
class << self