summaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
diff options
context:
space:
mode:
authorJohn Ericson <git@JohnEricson.me>2019-05-12 12:38:11 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2019-05-15 14:21:47 +0300
commit4030e7cb7ad54dd2df0686f41459fc6293c8284f (patch)
treee7366f78785419ad7d301fb68bc4b508fba9079e /mesonbuild/interpreter.py
parent7b8ef78bc0002d0327626c6218b793f87c2a5eb8 (diff)
downloadmeson-4030e7cb7ad54dd2df0686f41459fc6293c8284f.tar.gz
UserOption no longer has a name field.
This avoids the duplication where the option is stored in a dict at its name, and also contains its own name. In general, the maxim in programming is things shouldn't know their own name, so removed the name field just leaving the option's position in the dictionary as its name.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index fe12a7b58..1e8f97232 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -60,12 +60,12 @@ def stringifyUserArguments(args):
class FeatureOptionHolder(InterpreterObject, ObjectHolder):
- def __init__(self, env, option):
+ def __init__(self, env, name, option):
InterpreterObject.__init__(self)
ObjectHolder.__init__(self, option)
if option.is_auto():
self.held_object = env.coredata.builtins['auto_features']
- self.name = option.name
+ self.name = name
self.methods.update({'enabled': self.enabled_method,
'disabled': self.disabled_method,
'auto': self.auto_method,
@@ -2536,7 +2536,7 @@ external dependencies (including libraries) must go to "dependencies".''')
'options of other subprojects.')
opt = self.get_option_internal(optname)
if isinstance(opt, coredata.UserFeatureOption):
- return FeatureOptionHolder(self.environment, opt)
+ return FeatureOptionHolder(self.environment, optname, opt)
elif isinstance(opt, coredata.UserOption):
return opt.value
return opt