Skip to content

Commit 201f6a1

Browse files
zenspiderkddnewton
authored andcommitted
ruby_parser: add ability to subclass compiler to override methods.
1 parent 6c1c65f commit 201f6a1

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

lib/prism/translation/ruby_parser.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,7 +1562,7 @@ def attach_comments(sexp, node)
15621562

15631563
# Create a new compiler with the given options.
15641564
def copy_compiler(in_def: self.in_def, in_pattern: self.in_pattern)
1565-
Compiler.new(file, in_def: in_def, in_pattern: in_pattern)
1565+
self.class.new(file, in_def: in_def, in_pattern: in_pattern)
15661566
end
15671567

15681568
# Create a new Sexp object from the given prism node and arguments.
@@ -1624,7 +1624,6 @@ def visit_write_value(node)
16241624
end
16251625
end
16261626

1627-
private_constant :Compiler
16281627
attr_accessor :scopes # :nodoc:
16291628

16301629
def initialize scopes:nil # :nodoc:
@@ -1677,7 +1676,7 @@ def translate(result, filepath)
16771676
end
16781677

16791678
result.attach_comments!
1680-
result.value.accept(Compiler.new(filepath))
1679+
result.value.accept(self.class::Compiler.new(filepath))
16811680
end
16821681
end
16831682
end

0 commit comments

Comments
 (0)