Browse Source

add F_operator flag

rdb 12 years ago
parent
commit
5b1ea47fee

+ 1 - 0
dtool/src/cppparser/cppFunctionType.h

@@ -35,6 +35,7 @@ public:
     F_destructor        = 0x08,
     F_method_pointer    = 0x10,
     F_unary_op          = 0x20,
+    F_operator          = 0x40,
   };
 
   CPPFunctionType(CPPType *return_type, CPPParameterList *parameters,

+ 9 - 5
dtool/src/cppparser/cppInstanceIdentifier.cxx

@@ -134,12 +134,16 @@ add_func_modifier(CPPParameterList *params, int flags) {
   // is really a unary operator, so set the unary_op flag.  Operators
   // () and [] are never considered unary operators.
   if (_ident != NULL && 
-      _ident->get_simple_name().substr(0, 9) == "operator " &&
-      _ident->get_simple_name() != string("operator ()") &&
-      _ident->get_simple_name() != string("operator []")) {
-    if (params->_parameters.empty()) {
-      flags |= CPPFunctionType::F_unary_op;
+      _ident->get_simple_name().substr(0, 9) == "operator ") {
+
+    if (_ident->get_simple_name() != string("operator ()") &&
+        _ident->get_simple_name() != string("operator []")) {
+      if (params->_parameters.empty()) {
+        flags |= CPPFunctionType::F_unary_op;
+      }
     }
+
+    flags |= CPPFunctionType::F_operator;
   }
 
   _modifiers.push_back(Modifier::func_type(params, flags));