interpreter: use typed_pos_args configuration_data

pull/8953/head
Dylan Baker 3 years ago
parent 982973f303
commit 6f6db0f2e3
  1. 9
      mesonbuild/interpreter/interpreter.py

@ -1055,15 +1055,12 @@ external dependencies (including libraries) must go to "dependencies".''')
return opt.value return opt.value
return opt return opt
@typed_pos_args('configuration_data', optargs=[dict])
@noKwargs @noKwargs
def func_configuration_data(self, node, args, kwargs): def func_configuration_data(self, node: mparser.BaseNode, args: T.Optional[dict], kwargs: 'TYPE_kwargs') -> ConfigurationDataObject:
if len(args) > 1: if args is not None:
raise InterpreterException('configuration_data takes only one optional positional arguments')
elif len(args) == 1:
FeatureNew.single_use('configuration_data dictionary', '0.49.0', self.subproject) FeatureNew.single_use('configuration_data dictionary', '0.49.0', self.subproject)
initial_values = args[0] initial_values = args[0]
if not isinstance(initial_values, dict):
raise InterpreterException('configuration_data first argument must be a dictionary')
else: else:
initial_values = {} initial_values = {}
return ConfigurationDataObject(self.subproject, initial_values) return ConfigurationDataObject(self.subproject, initial_values)

Loading…
Cancel
Save