[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.
|
# Lazily initialize the parse result.
|
||||||
def result
|
def result
|
||||||
@result ||= Prism.parse(source)
|
@result ||=
|
||||||
|
begin
|
||||||
|
scopes = RUBY_VERSION >= "3.3.0" ? [] : [[]]
|
||||||
|
Prism.parse(source, scopes: scopes)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
@ -1536,13 +1536,13 @@ module Prism
|
|||||||
# Parse the given source and translate it into the seattlerb/ruby_parser
|
# Parse the given source and translate it into the seattlerb/ruby_parser
|
||||||
# gem's Sexp format.
|
# gem's Sexp format.
|
||||||
def parse(source, filepath = "(string)")
|
def parse(source, filepath = "(string)")
|
||||||
translate(Prism.parse(source, filepath: filepath), filepath)
|
translate(Prism.parse(source, filepath: filepath, scopes: [[]]), filepath)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Parse the given file and translate it into the seattlerb/ruby_parser
|
# Parse the given file and translate it into the seattlerb/ruby_parser
|
||||||
# gem's Sexp format.
|
# gem's Sexp format.
|
||||||
def parse_file(filepath)
|
def parse_file(filepath)
|
||||||
translate(Prism.parse_file(filepath), filepath)
|
translate(Prism.parse_file(filepath, scopes: [[]]), filepath)
|
||||||
end
|
end
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
Loading…
x
Reference in New Issue
Block a user