add F_operator flag

This commit is contained in:
rdb 2013-11-18 18:37:27 +00:00
parent 52e4acc0ce
commit 5b1ea47fee
2 changed files with 10 additions and 5 deletions

View File

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

View File

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