Skip to content

Commit 3a353fb

Browse files
committed
Use the prism builder when available
prism requires its own builder class in order to emit ast for versions that the parser gem doesn't support. The next prism version will warn when a incorrect builder class is used, it wasn't previously enforced.
1 parent b03d5bb commit 3a353fb

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

lib/packwerk/parsers/ruby.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ def valid_error?(error)
2828
end
2929
end
3030

31-
class TolerateInvalidUtf8Builder < Parser::Builders::Default
31+
# Remove when prism > 1.4.0 is required
32+
builder_class = if defined?(Prism::Translation::Parser::Builder)
33+
Prism::Translation::Parser::Builder
34+
else
35+
Parser::Builders::Default
36+
end
37+
class TolerateInvalidUtf8Builder < builder_class
3238
extend T::Sig
3339

3440
sig { params(token: T.untyped).returns(T.untyped) }

0 commit comments

Comments
 (0)