Output all current stacked messages

Return true if no errors occurred.

If some errors occurred, the behavior depends on the value of keep_going. If keep_going is false, then the total error informations is displayed and the program exits. Else, false is returned.

Property definitions

nitc $ ToolContext :: check_errors
	# Output all current stacked messages
	#
	# Return true if no errors occurred.
	#
	# If some errors occurred, the behavior depends on the value of `keep_going`.
	# If `keep_going` is false, then the total error informations is displayed and the program exits.
	# Else, false is returned.
	fun check_errors: Bool
	do
		if messages.length > 0 then
			message_sorter.sort(messages)

			for m in messages do
				if opt_no_color.value then
					sys.stderr.write("{m}\n")
				else
					sys.stderr.write("{m.to_color_string}\n")
				end
			end

			messages.clear
		end

		if error_count > 0 then
			if not keep_going then
				errors_info
				exit(1)
			end
			return false
		end
		return true
	end
src/toolcontext.nit:196,2--227,4