Kaynağa Gözat

Merge interrogate/bullet fix into master

rdb 10 yıl önce
ebeveyn
işleme
efdd5c88c6

+ 13 - 5
dtool/src/cppparser/cppExpression.cxx

@@ -26,6 +26,7 @@
 #include "cppFunctionGroup.h"
 #include "cppFunctionType.h"
 #include "cppBison.h"
+#include "pdtoa.h"
 
 #include <assert.h>
 
@@ -1079,7 +1080,13 @@ output(ostream &out, int indent_level, CPPScope *scope, bool) const {
     break;
 
   case T_real:
-    out << _u._real;
+    {
+      // We use our own dtoa implementation here because it guarantees
+      // to never format the number as an integer.
+      char buffer[32];
+      pdtoa(_u._real, buffer);
+      out << buffer;
+    }
     break;
 
   case T_string:
@@ -1155,14 +1162,15 @@ output(ostream &out, int indent_level, CPPScope *scope, bool) const {
     break;
 
   case T_construct:
-    out << "(" << _u._typecast._to->get_typedef_name(scope)
-        << "(";
+    _u._typecast._to->output(out, indent_level, scope, false);
+    out << "(";
     _u._typecast._op1->output(out, indent_level, scope, false);
-    out << "))";
+    out << ")";
     break;
 
   case T_default_construct:
-    out << "(" << _u._typecast._to->get_typedef_name(scope) << "())";
+    _u._typecast._to->output(out, indent_level, scope, false);
+    out << "()";
     break;
 
   case T_new:

+ 1 - 1
dtool/src/cppparser/cppInstance.cxx

@@ -558,7 +558,7 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete,
     out << " = 0";
   }
   if (_initializer != NULL) {
-    out << " = (" << *_initializer << ")";
+    out << " = " << *_initializer;
   }
 }