lib/tapioca/compilers/dsl_compiler.rb in tapioca-0.5.2 vs lib/tapioca/compilers/dsl_compiler.rb in tapioca-0.5.3

- old
+ new

@@ -32,11 +32,11 @@ ) @requested_constants = requested_constants @error_handler = T.let(error_handler || $stderr.method(:puts), T.proc.params(error: String).void) end - sig { params(blk: T.proc.params(constant: Module, rbi: String).void).void } + sig { params(blk: T.proc.params(constant: Module, rbi: RBI::File).void).void } def run(&blk) constants_to_process = gather_constants(requested_constants) if constants_to_process.empty? report_error(<<~ERROR) @@ -49,10 +49,14 @@ rbi = rbi_for_constant(constant) next if rbi.nil? blk.call(constant, rbi) end + + generators.flat_map(&:errors).each do |msg| + report_error(msg) + end end private sig do @@ -75,24 +79,21 @@ constants = generators.map(&:processable_constants).reduce(Set.new, :union) constants &= requested_constants unless requested_constants.empty? constants end - sig { params(constant: Module).returns(T.nilable(String)) } + sig { params(constant: Module).returns(T.nilable(RBI::File)) } def rbi_for_constant(constant) file = RBI::File.new(strictness: "true") generators.each do |generator| next unless generator.handles?(constant) generator.decorate(file.root, constant) end return if file.root.empty? - file.root.nest_non_public_methods! - file.root.group_nodes! - file.root.sort_nodes! - file.string + file end sig { params(error: String).returns(T.noreturn) } def report_error(error) handler = error_handler