From ae88549797c01283e8cb1599863a7614a165016c Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Thu, 18 Sep 2014 15:50:54 -0500 Subject: Remove fails_with? from the formula instance --- Library/Homebrew/compilers.rb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'Library/Homebrew/compilers.rb') diff --git a/Library/Homebrew/compilers.rb b/Library/Homebrew/compilers.rb index 7080f69e7..b445213ec 100644 --- a/Library/Homebrew/compilers.rb +++ b/Library/Homebrew/compilers.rb @@ -99,8 +99,11 @@ class CompilerQueue end class CompilerSelector - def initialize(f, versions=MacOS) - @f = f + attr_reader :formula + + def initialize(formula, versions=MacOS) + @formula = formula + @failures = formula.compiler_failures @versions = versions @compilers = CompilerQueue.new %w{clang llvm gcc gcc_4_0}.map(&:to_sym).each do |cc| @@ -125,13 +128,17 @@ class CompilerSelector # if none can be found raises CompilerError instead def compiler while cc = @compilers.pop - return cc.name unless @f.fails_with?(cc) + return cc.name unless fails_with?(cc) end - raise CompilerSelectionError.new(@f) + raise CompilerSelectionError.new(formula) end private + def fails_with?(compiler) + @failures.any? { |failure| failure === compiler } + end + def priority_for(cc) case cc when :clang then @versions.clang_build_version >= 318 ? 3 : 0.5 -- cgit v1.2.3