|
@@ -201,6 +201,19 @@ output(ostream &out) const {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: CPPExpression::Constructor
|
|
|
|
|
+// Access: Public
|
|
|
|
|
+// Description:
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+CPPExpression::
|
|
|
|
|
+CPPExpression(bool value) :
|
|
|
|
|
+ CPPDeclaration(CPPFile())
|
|
|
|
|
+{
|
|
|
|
|
+ _type = T_boolean;
|
|
|
|
|
+ _u._boolean = value;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: CPPExpression::Constructor
|
|
// Function: CPPExpression::Constructor
|
|
|
// Access: Public
|
|
// Access: Public
|
|
@@ -540,6 +553,9 @@ evaluate() const {
|
|
|
case T_nullptr:
|
|
case T_nullptr:
|
|
|
return Result((void *)0);
|
|
return Result((void *)0);
|
|
|
|
|
|
|
|
|
|
+ case T_boolean:
|
|
|
|
|
+ return Result((int)_u._boolean);
|
|
|
|
|
+
|
|
|
case T_integer:
|
|
case T_integer:
|
|
|
return Result((int)_u._integer);
|
|
return Result((int)_u._integer);
|
|
|
|
|
|
|
@@ -580,8 +596,12 @@ evaluate() const {
|
|
|
if (r1._type != RT_error) {
|
|
if (r1._type != RT_error) {
|
|
|
CPPSimpleType *stype = _u._typecast._to->as_simple_type();
|
|
CPPSimpleType *stype = _u._typecast._to->as_simple_type();
|
|
|
if (stype != NULL) {
|
|
if (stype != NULL) {
|
|
|
- if (stype->_type == CPPSimpleType::T_int) {
|
|
|
|
|
|
|
+ if (stype->_type == CPPSimpleType::T_bool) {
|
|
|
|
|
+ return Result(r1.as_boolean());
|
|
|
|
|
+
|
|
|
|
|
+ } else if (stype->_type == CPPSimpleType::T_int) {
|
|
|
return Result(r1.as_integer());
|
|
return Result(r1.as_integer());
|
|
|
|
|
+
|
|
|
} else if (stype->_type == CPPSimpleType::T_float ||
|
|
} else if (stype->_type == CPPSimpleType::T_float ||
|
|
|
stype->_type == CPPSimpleType::T_double) {
|
|
stype->_type == CPPSimpleType::T_double) {
|
|
|
return Result(r1.as_real());
|
|
return Result(r1.as_real());
|
|
@@ -879,6 +899,9 @@ determine_type() const {
|
|
|
case T_nullptr:
|
|
case T_nullptr:
|
|
|
return nullptr_type;
|
|
return nullptr_type;
|
|
|
|
|
|
|
|
|
|
+ case T_boolean:
|
|
|
|
|
+ return bool_type;
|
|
|
|
|
+
|
|
|
case T_integer:
|
|
case T_integer:
|
|
|
return int_type;
|
|
return int_type;
|
|
|
|
|
|
|
@@ -1060,6 +1083,7 @@ is_fully_specified() const {
|
|
|
|
|
|
|
|
switch (_type) {
|
|
switch (_type) {
|
|
|
case T_nullptr:
|
|
case T_nullptr:
|
|
|
|
|
+ case T_boolean:
|
|
|
case T_integer:
|
|
case T_integer:
|
|
|
case T_real:
|
|
case T_real:
|
|
|
case T_string:
|
|
case T_string:
|
|
@@ -1314,6 +1338,10 @@ output(ostream &out, int indent_level, CPPScope *scope, bool) const {
|
|
|
out << "nullptr";
|
|
out << "nullptr";
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
|
|
+ case T_boolean:
|
|
|
|
|
+ out << (_u._boolean ? "true" : "false");
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
case T_integer:
|
|
case T_integer:
|
|
|
out << _u._integer;
|
|
out << _u._integer;
|
|
|
break;
|
|
break;
|
|
@@ -1748,6 +1776,9 @@ is_equal(const CPPDeclaration *other) const {
|
|
|
case T_nullptr:
|
|
case T_nullptr:
|
|
|
return true;
|
|
return true;
|
|
|
|
|
|
|
|
|
|
+ case T_boolean:
|
|
|
|
|
+ return _u._boolean == ot->_u._boolean;
|
|
|
|
|
+
|
|
|
case T_integer:
|
|
case T_integer:
|
|
|
return _u._integer == ot->_u._integer;
|
|
return _u._integer == ot->_u._integer;
|
|
|
|
|
|
|
@@ -1828,6 +1859,9 @@ is_less(const CPPDeclaration *other) const {
|
|
|
case T_nullptr:
|
|
case T_nullptr:
|
|
|
return false;
|
|
return false;
|
|
|
|
|
|
|
|
|
|
+ case T_boolean:
|
|
|
|
|
+ return _u._boolean < ot->_u._boolean;
|
|
|
|
|
+
|
|
|
case T_integer:
|
|
case T_integer:
|
|
|
return _u._integer < ot->_u._integer;
|
|
return _u._integer < ot->_u._integer;
|
|
|
|
|
|