mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 00:32:57 -04:00
cppparser: hack fix for method defs in parentheses
This commit is contained in:
parent
0247f9e3fa
commit
fb5440bd07
File diff suppressed because it is too large
Load Diff
@ -1218,6 +1218,35 @@ constructor_prototype:
|
|||||||
CPPInstanceIdentifier *ii = new CPPInstanceIdentifier($1);
|
CPPInstanceIdentifier *ii = new CPPInstanceIdentifier($1);
|
||||||
ii->add_func_modifier($4, $6);
|
ii->add_func_modifier($4, $6);
|
||||||
|
|
||||||
|
$$ = new CPPInstance(type, ii, 0, @1.file);
|
||||||
|
}
|
||||||
|
/* This is a hack to support functions with the identifier enveloped by a
|
||||||
|
pair of parentheses. */
|
||||||
|
| TYPENAME_IDENTIFIER '(' IDENTIFIER ')' '('
|
||||||
|
{
|
||||||
|
// Create a scope for this function.
|
||||||
|
CPPScope *scope = new CPPScope($3->get_scope(current_scope, global_scope),
|
||||||
|
$3->_names.back(), V_private);
|
||||||
|
|
||||||
|
// It still needs to be able to pick up any template arguments, if this is
|
||||||
|
// a definition for a method template. Add a fake "using" declaration to
|
||||||
|
// accomplish this.
|
||||||
|
scope->_using.insert(current_scope);
|
||||||
|
|
||||||
|
push_scope(scope);
|
||||||
|
}
|
||||||
|
function_parameter_list ')' function_post
|
||||||
|
{
|
||||||
|
pop_scope();
|
||||||
|
CPPType *type = $1->find_type(current_scope, global_scope, false, current_lexer);
|
||||||
|
if (type == nullptr) {
|
||||||
|
yyerror(string("internal error resolving type ") + $1->get_fully_scoped_name(), @1);
|
||||||
|
}
|
||||||
|
assert(type != nullptr);
|
||||||
|
|
||||||
|
CPPInstanceIdentifier *ii = new CPPInstanceIdentifier($3);
|
||||||
|
ii->add_func_modifier($7, $9);
|
||||||
|
|
||||||
$$ = new CPPInstance(type, ii, 0, @1.file);
|
$$ = new CPPInstance(type, ii, 0, @1.file);
|
||||||
}
|
}
|
||||||
| TYPENAME_IDENTIFIER '('
|
| TYPENAME_IDENTIFIER '('
|
||||||
|
Loading…
x
Reference in New Issue
Block a user