From 841da29d2cc185e7bc96f4d97ec2963472840e9c Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Sat, 2 Mar 2019 02:57:24 -0800 Subject: Fix ternary in thing (#5007) * tests: extend ternary test to cover bugs See issues #5003, #3690, and #2404 * mparser: store subdir in ternary node Ternaries don't really need subdirs, but they can be passed into functions that expect the type they're provided to have a subdir. Provide it to fulful the interface. Fixes #5003 Fixes #3690 Fixes #2404 --- mesonbuild/mparser.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mesonbuild/mparser.py') diff --git a/mesonbuild/mparser.py b/mesonbuild/mparser.py index f18352b..e6a1bce 100644 --- a/mesonbuild/mparser.py +++ b/mesonbuild/mparser.py @@ -405,7 +405,8 @@ class IfNode(BaseNode): self.block = block class TernaryNode(BaseNode): - def __init__(self, lineno, colno, condition, trueblock, falseblock): + def __init__(self, subdir, lineno, colno, condition, trueblock, falseblock): + self.subdir = subdir self.lineno = lineno self.colno = colno self.condition = condition @@ -540,7 +541,7 @@ class Parser: self.expect('colon') falseblock = self.e1() self.in_ternary = False - return TernaryNode(left.lineno, left.colno, left, trueblock, falseblock) + return TernaryNode(left.subdir, left.lineno, left.colno, left, trueblock, falseblock) return left def e2(self): -- cgit v1.1