@@ -1625,17 +1625,23 @@ def visit_write_value(node)
16251625 end
16261626
16271627 private_constant :Compiler
1628+ attr_accessor :scopes # :nodoc:
1629+
1630+ def initialize scopes :nil # :nodoc:
1631+ super ( )
1632+ self . scopes = [ scopes ] if scopes
1633+ end
16281634
16291635 # Parse the given source and translate it into the seattlerb/ruby_parser
16301636 # gem's Sexp format.
16311637 def parse ( source , filepath = "(string)" )
1632- translate ( Prism . parse ( source , filepath : filepath , partial_script : true ) , filepath )
1638+ translate ( Prism . parse ( source , filepath : filepath , partial_script : true , scopes : scopes ) , filepath )
16331639 end
16341640
16351641 # Parse the given file and translate it into the seattlerb/ruby_parser
16361642 # gem's Sexp format.
16371643 def parse_file ( filepath )
1638- translate ( Prism . parse_file ( filepath , partial_script : true ) , filepath )
1644+ translate ( Prism . parse_file ( filepath , partial_script : true , scopes : scopes ) , filepath )
16391645 end
16401646
16411647 # Parse the give file and translate it into the
@@ -1649,14 +1655,14 @@ def process(ruby, file = "(string)", timeout = nil)
16491655 class << self
16501656 # Parse the given source and translate it into the seattlerb/ruby_parser
16511657 # gem's Sexp format.
1652- def parse ( source , filepath = "(string)" )
1653- new . parse ( source , filepath )
1658+ def parse ( source , filepath = "(string)" , scopes : nil )
1659+ new ( scopes : scopes ) . parse ( source , filepath )
16541660 end
16551661
16561662 # Parse the given file and translate it into the seattlerb/ruby_parser
16571663 # gem's Sexp format.
1658- def parse_file ( filepath )
1659- new . parse_file ( filepath )
1664+ def parse_file ( filepath , scopes : nil )
1665+ new ( scopes : scopes ) . parse_file ( filepath )
16601666 end
16611667 end
16621668
0 commit comments