diff options
-rw-r--r-- | mesonbuild/interpreterbase.py | 6 | ||||
-rw-r--r-- | test cases/common/235 disabler array addition/meson.build | 9 | ||||
-rw-r--r-- | test cases/common/235 disabler array addition/test.c | 1 |
3 files changed, 12 insertions, 4 deletions
diff --git a/mesonbuild/interpreterbase.py b/mesonbuild/interpreterbase.py index 822167c..6c4f273 100644 --- a/mesonbuild/interpreterbase.py +++ b/mesonbuild/interpreterbase.py @@ -810,9 +810,7 @@ The result of this is undefined and will become a hard error in a future Meson r assert(isinstance(node, mparser.PlusAssignmentNode)) varname = node.var_name addition = self.evaluate_statement(node.value) - if is_disabler(addition): - self.set_variable(varname, addition) - return + # Remember that all variables are immutable. We must always create a # full new variable and then assign it. old_variable = self.get_variable(varname) @@ -836,7 +834,7 @@ The result of this is undefined and will become a hard error in a future Meson r new_value = {**old_variable, **addition} # Add other data types here. else: - raise InvalidArguments('The += operator currently only works with arrays, dicts, strings or ints ') + raise InvalidArguments('The += operator currently only works with arrays, dicts, strings or ints') self.set_variable(varname, new_value) def evaluate_indexing(self, node: mparser.IndexNode) -> TYPE_var: diff --git a/test cases/common/235 disabler array addition/meson.build b/test cases/common/235 disabler array addition/meson.build new file mode 100644 index 0000000..231f76a --- /dev/null +++ b/test cases/common/235 disabler array addition/meson.build @@ -0,0 +1,9 @@ +project('disabler_inside_array', 'c') + +exes = [] + +exes += library('a', 'test.c') + +exes += library('b', 'test.c', dependencies : disabler()) + +exes += library('c', 'test.c') diff --git a/test cases/common/235 disabler array addition/test.c b/test cases/common/235 disabler array addition/test.c new file mode 100644 index 0000000..e9a7aac --- /dev/null +++ b/test cases/common/235 disabler array addition/test.c @@ -0,0 +1 @@ +int stub(void) { return 0; } |