mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 08:15:18 -04:00
cppparser: Prefer function over type when searching symbol
This is meant to fix the "stat problem", which means you can define a function with the same name as a struct, which is allowed, since you can still refer to the struct with an explicit `struct stat`. It can be reproduced with the following code: struct stat; void stat(); void *ptr = (void *)stat;
This commit is contained in:
parent
50538203ce
commit
ae8d643907
@ -724,6 +724,12 @@ find_symbol(const string &name, bool recurse) const {
|
|||||||
return _struct_type;
|
return _struct_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Functions::const_iterator fi;
|
||||||
|
fi = _functions.find(name);
|
||||||
|
if (fi != _functions.end()) {
|
||||||
|
return (*fi).second;
|
||||||
|
}
|
||||||
|
|
||||||
Types::const_iterator ti;
|
Types::const_iterator ti;
|
||||||
ti = _types.find(name);
|
ti = _types.find(name);
|
||||||
if (ti != _types.end()) {
|
if (ti != _types.end()) {
|
||||||
@ -741,12 +747,6 @@ find_symbol(const string &name, bool recurse) const {
|
|||||||
return (*vi).second;
|
return (*vi).second;
|
||||||
}
|
}
|
||||||
|
|
||||||
Functions::const_iterator fi;
|
|
||||||
fi = _functions.find(name);
|
|
||||||
if (fi != _functions.end()) {
|
|
||||||
return (*fi).second;
|
|
||||||
}
|
|
||||||
|
|
||||||
Using::const_iterator ui;
|
Using::const_iterator ui;
|
||||||
for (ui = _using.begin(); ui != _using.end(); ++ui) {
|
for (ui = _using.begin(); ui != _using.end(); ++ui) {
|
||||||
CPPDeclaration *decl = (*ui)->find_symbol(name, false);
|
CPPDeclaration *decl = (*ui)->find_symbol(name, false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user