ast: fully resolve nodes for add operation

Otherwise, string + stringmethod results in a list of two strings instead of the concatenation of the strings
pull/12152/head
Charles Brunet 1 year ago
parent 11ef2a536c
commit 6a18ae48b3
  1. 4
      mesonbuild/ast/interpreter.py

@ -371,8 +371,8 @@ class AstInterpreter(InterpreterBase):
elif isinstance(node, ArithmeticNode):
if node.operation != 'add':
return None # Only handle string and array concats
l = quick_resolve(node.left)
r = quick_resolve(node.right)
l = self.resolve_node(node.left, include_unknown_args, id_loop_detect)
r = self.resolve_node(node.right, include_unknown_args, id_loop_detect)
if isinstance(l, str) and isinstance(r, str):
result = l + r # String concatenation detected
else:

Loading…
Cancel
Save