Skip to content

Commit 2f1f3fa

Browse files
committed
Move more features under autoload
1 parent 52bd001 commit 2f1f3fa

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

lib/yarp.rb

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -547,21 +547,25 @@ def self.parse_serialize_file(filepath)
547547
# which means the files can end up being quite large. We autoload them to make
548548
# our require speed faster since consuming libraries are unlikely to use all
549549
# of these features.
550+
autoload :DesugarVisitor, "yarp/desugar_visitor"
550551
autoload :Dispatcher, "yarp/dispatcher"
552+
autoload :MutationVisitor, "yarp/mutation_visitor"
553+
autoload :RipperCompat, "yarp/ripper_compat"
554+
autoload :Pack, "yarp/pack"
555+
autoload :Pattern, "yarp/pattern"
556+
autoload :Serialize, "yarp/serialize"
551557
end
552558

553559
require_relative "yarp/lex_compat"
554-
require_relative "yarp/mutation_visitor"
555-
require_relative "yarp/desugar_visitor"
556560
require_relative "yarp/node"
557-
require_relative "yarp/ripper_compat"
558-
require_relative "yarp/serialize"
559-
require_relative "yarp/pack"
560-
require_relative "yarp/pattern"
561561

562562
require_relative "yarp/parse_result/comments"
563563
require_relative "yarp/parse_result/newlines"
564564

565+
# This is a Ruby implementation of the YARP parser. If we're running on CRuby
566+
# and we haven't explicitly set the YARP_FFI_BACKEND environment variable, then
567+
# it's going to require the built library. Otherwise, it's going to require a
568+
# module that uses FFI to call into the library.
565569
if RUBY_ENGINE == "ruby" and !ENV["YARP_FFI_BACKEND"]
566570
require "yarp/yarp"
567571
else

0 commit comments

Comments
 (0)