From 5b1ea47fee1a9e11576f93803361657493a49eb4 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 18 Nov 2013 18:37:27 +0000 Subject: [PATCH] add F_operator flag --- dtool/src/cppparser/cppFunctionType.h | 1 + dtool/src/cppparser/cppInstanceIdentifier.cxx | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/dtool/src/cppparser/cppFunctionType.h b/dtool/src/cppparser/cppFunctionType.h index 09cb46491f..021aeba5ce 100644 --- a/dtool/src/cppparser/cppFunctionType.h +++ b/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, diff --git a/dtool/src/cppparser/cppInstanceIdentifier.cxx b/dtool/src/cppparser/cppInstanceIdentifier.cxx index aea8eee9ce..8db68d389d 100644 --- a/dtool/src/cppparser/cppInstanceIdentifier.cxx +++ b/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));