summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2011-10-24 11:47:09 (GMT)
committerMarius Kintel <marius@kintel.net>2011-10-24 11:47:09 (GMT)
commit8aa762d4d5da7e267094cfc35589c2d7f179bb63 (patch)
treec7811cd445ee9df048c80311ba9f006c206c16e1
parent82ff5a12ec876c80a626357557fa8afdbf0721cc (diff)
parentff6d6cda13040e69ef15bb8989ca0f436a8020cc (diff)
Merge branch 'master' into visitortests
-rw-r--r--RELEASE_NOTES2
-rw-r--r--src/CSGTermEvaluator.h1
-rw-r--r--src/expr.cc4
3 files changed, 3 insertions, 4 deletions
diff --git a/RELEASE_NOTES b/RELEASE_NOTES
index aaeddb1..3af3c1a 100644
--- a/RELEASE_NOTES
+++ b/RELEASE_NOTES
@@ -8,7 +8,7 @@ o New import() statement reads the correct file format based on the filename ext
(.stl, .dxf and .off is supported)
o The color() statement now supports an alpha parameter, e.g. color(c=[1,0,0], alpha=0.4)
o The color() statement now supports specifying colors as strings, e.g. color("Red")
-o if() and else() can now take any value type as parameter. false, 0, empty string and empty vector or illegal value type will evaluate as false, everything else as true.
+o if()/else() and the ternary operator can now take any value type as parameter. false, 0, empty string and empty vector or illegal value type will evaluate as false, everything else as true.
o Strings can now be lexographically compared using the <, <=, >, >= operators
o The version() function will return the OpenSCAD version as a vector, e.g. [2011, 09]
o The version_num() function will return the OpenSCAD version as a number, e.g. 20110923
diff --git a/src/CSGTermEvaluator.h b/src/CSGTermEvaluator.h
index cca6c91..3a8122b 100644
--- a/src/CSGTermEvaluator.h
+++ b/src/CSGTermEvaluator.h
@@ -4,6 +4,7 @@
#include <map>
#include <list>
#include <vector>
+#include <cstddef>
#include "visitor.h"
class CSGTermEvaluator : public Visitor
diff --git a/src/expr.cc b/src/expr.cc
index c9eda4e..fc1fbf0 100644
--- a/src/expr.cc
+++ b/src/expr.cc
@@ -75,9 +75,7 @@ Value Expression::evaluate(const Context *context) const
return this->children[0]->evaluate(context) > this->children[1]->evaluate(context);
if (this->type == "?:") {
Value v = this->children[0]->evaluate(context);
- if (v.type == Value::BOOL)
- return this->children[v.b ? 1 : 2]->evaluate(context);
- return Value();
+ return this->children[v.toBool() ? 1 : 2]->evaluate(context);
}
if (this->type == "[]") {
Value v1 = this->children[0]->evaluate(context);
contact: Jan Huwald // Impressum