[ruby/prism] Assume eval context for ruby_parser and ripper
https://github.com/ruby/prism/commit/e4d6984892
This commit is contained in:
parent
32b1dea566
commit
1d51e929b1
@ -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
|
||||
|
||||
##########################################################################
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user