mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 09:23:03 -04:00
cppparser: fix issues when parsing templated constructor definition
This commit is contained in:
parent
fe1bfef5c0
commit
30721ba33b
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,8 @@
|
|||||||
/* A Bison parser, made by GNU Bison 3.0.4. */
|
/* A Bison parser, made by GNU Bison 3.0.5. */
|
||||||
|
|
||||||
/* Bison interface for Yacc-like parsers in C
|
/* Bison interface for Yacc-like parsers in C
|
||||||
|
|
||||||
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
|
Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1185,14 +1185,27 @@ constructor_prototype:
|
|||||||
/* Functions with implicit return types, and constructors */
|
/* Functions with implicit return types, and constructors */
|
||||||
IDENTIFIER '('
|
IDENTIFIER '('
|
||||||
{
|
{
|
||||||
push_scope($1->get_scope(current_scope, global_scope));
|
// Create a scope for this function.
|
||||||
|
CPPScope *scope = new CPPScope($1->get_scope(current_scope, global_scope),
|
||||||
|
$1->_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
|
function_parameter_list ')' function_post
|
||||||
{
|
{
|
||||||
|
CPPScope *scope = $1->get_scope(current_scope, global_scope);
|
||||||
CPPType *type;
|
CPPType *type;
|
||||||
if ($1->get_simple_name() == current_scope->get_simple_name() ||
|
std::string simple_name = $1->get_simple_name();
|
||||||
$1->get_simple_name() == string("~") + current_scope->get_simple_name()) {
|
if (!simple_name.empty() && simple_name[0] == '~') {
|
||||||
// This is a constructor, and has no return.
|
// A destructor has no return type.
|
||||||
|
type = new CPPSimpleType(CPPSimpleType::T_void);
|
||||||
|
} else if (scope != nullptr && simple_name == scope->get_simple_name()) {
|
||||||
|
// Neither does a constructor.
|
||||||
type = new CPPSimpleType(CPPSimpleType::T_void);
|
type = new CPPSimpleType(CPPSimpleType::T_void);
|
||||||
} else {
|
} else {
|
||||||
// This isn't a constructor, so it has an implicit return type of
|
// This isn't a constructor, so it has an implicit return type of
|
||||||
@ -1209,7 +1222,16 @@ constructor_prototype:
|
|||||||
}
|
}
|
||||||
| TYPENAME_IDENTIFIER '('
|
| TYPENAME_IDENTIFIER '('
|
||||||
{
|
{
|
||||||
push_scope($1->get_scope(current_scope, global_scope));
|
// Create a scope for this function.
|
||||||
|
CPPScope *scope = new CPPScope($1->get_scope(current_scope, global_scope),
|
||||||
|
$1->_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
|
function_parameter_list ')' function_post
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user