function Promise.prototype.cancel(c)if c._status~=Promise.Status.Started then return end c._status=Promise.Status.Cancelled if c._cancellationHook then c._cancellationHook()end if c._parent then c._parent:_consumerCancelled(c)end for c in pairs(c._consumers)do c:cancel()end c:_finalize()end Promise.prototype.Cancel=Promise.prototype.cancel

function Promise.prototype:cancel()
	if self._status ~= Promise.Status.Started then
		return
	end

	self._status = Promise.Status.Cancelled

	if self._cancellationHook then
		self._cancellationHook()
	end

	if self._parent then
		self._parent:_consumerCancelled(self)
	end

	for child in pairs(self._consumers) do
		child:cancel()
	end

	self:_finalize()
end
Promise.prototype.Cancel = Promise.prototype.cancel
