lib/nanoc/base/services/compiler/phases/resume.rb in nanoc-4.9.6 vs lib/nanoc/base/services/compiler/phases/resume.rb in nanoc-4.9.7

- old
+ new

@@ -3,10 +3,12 @@ module Nanoc::Int::Compiler::Phases # Provides functionality for suspending and resuming item rep compilation (using fibers). class Resume < Abstract include Nanoc::Int::ContractsSupport + DONE = Object.new + def initialize(wrapped:) super(wrapped: wrapped) end contract Nanoc::Int::ItemRep, C::KeywordArgs[is_outdated: C::Bool], C::Func[C::None => C::Any] => C::Any @@ -20,12 +22,16 @@ when Nanoc::Int::Errors::UnmetDependency Nanoc::Int::NotificationCenter.post(:compilation_suspended, rep, res) raise(res) when Proc fiber.resume(res.call) + when DONE # rubocop:disable Lint/EmptyWhen + # ignore else - # TODO: raise + raise Nanoc::Int::Errors::InternalInconsistency.new( + "Fiber yielded object of unexpected type #{res.class}", + ) end end Nanoc::Int::NotificationCenter.post(:compilation_ended, rep) end @@ -38,9 +44,10 @@ @fibers[rep] ||= Fiber.new do yield @fibers.delete(rep) + DONE end @fibers[rep] end end