Factor out more option iterating
This commit is contained in:
parent
f9a35e08ac
commit
9b13fb3672
|
@ -483,8 +483,13 @@ class CoreData:
|
|||
yield self.compiler_options
|
||||
yield self.base_options
|
||||
|
||||
def get_all_options(self):
|
||||
return chain(
|
||||
iter([self.builtins]),
|
||||
self._get_all_nonbuiltin_options())
|
||||
|
||||
def validate_option_value(self, option_name, override_value):
|
||||
for opts in chain(iter([self.builtins]), self._get_all_nonbuiltin_options()):
|
||||
for opts in self.get_all_options():
|
||||
if option_name in opts:
|
||||
opt = opts[option_name]
|
||||
return opt.validate_value(override_value)
|
||||
|
|
|
@ -1957,10 +1957,7 @@ class Interpreter(InterpreterBase):
|
|||
def get_non_matching_default_options(self):
|
||||
env = self.environment
|
||||
for def_opt_name, def_opt_value in self.project_default_options.items():
|
||||
for option_type in [
|
||||
env.coredata.builtins, env.coredata.compiler_options,
|
||||
env.coredata.backend_options, env.coredata.base_options,
|
||||
env.coredata.user_options]:
|
||||
for option_type in env.coredata.get_all_options():
|
||||
for cur_opt_name, cur_opt_value in option_type.items():
|
||||
if (def_opt_name == cur_opt_name and
|
||||
def_opt_value != cur_opt_value.value):
|
||||
|
|
Loading…
Reference in New Issue