diff options
author | Marius Kintel <marius@kintel.net> | 2013-06-26 03:39:02 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-06-26 03:39:02 (GMT) |
commit | 1b7cc41a7f454e005ca07815ba463a7fac5e1f8e (patch) | |
tree | 85f0d93ef9d547d17bd536d58e36be575d6ab0b9 /src/expr.cc | |
parent | d9b3f7b52b3c3d5c21dc11234325739d3e28ee02 (diff) |
Short circuit boolean logic - fixes #411
Diffstat (limited to 'src/expr.cc')
-rw-r--r-- | src/expr.cc | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/expr.cc b/src/expr.cc index 2e069f0..8500d13 100644 --- a/src/expr.cc +++ b/src/expr.cc @@ -105,8 +105,7 @@ Value Expression::evaluate(const Context *context) const if (this->type == ">") return this->children[0]->evaluate(context) > this->children[1]->evaluate(context); if (this->type == "?:") { - Value v = this->children[0]->evaluate(context); - return this->children[v.toBool() ? 1 : 2]->evaluate(context); + return this->children[this->children[0]->evaluate(context) ? 1 : 2]->evaluate(context); } if (this->type == "[]") { return this->children[0]->evaluate(context)[this->children[1]->evaluate(context)]; |