Commit 0a57618a by alokp@chromium.org

Reject shaders that invoke functions hidden by variable or struct name.

BUG=22 Review URL: http://codereview.appspot.com/1855057 git-svn-id: https://angleproject.googlecode.com/svn/trunk@375 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 003e7b13
...@@ -913,21 +913,24 @@ bool TParseContext::extensionErrorCheck(int line, const char* extension) ...@@ -913,21 +913,24 @@ bool TParseContext::extensionErrorCheck(int line, const char* extension)
// //
const TFunction* TParseContext::findFunction(int line, TFunction* call, bool *builtIn) const TFunction* TParseContext::findFunction(int line, TFunction* call, bool *builtIn)
{ {
const TSymbol* symbol = symbolTable.find(call->getMangledName(), builtIn); // First find by unmangled name to check whether the function name has been
// hidden by a variable name or struct typename.
const TSymbol* symbol = symbolTable.find(call->getName(), builtIn);
if (symbol == 0) {
symbol = symbolTable.find(call->getMangledName(), builtIn);
}
if (symbol == 0) { if (symbol == 0) {
error(line, "no matching overloaded function found", call->getName().c_str(), ""); error(line, "no matching overloaded function found", call->getName().c_str(), "");
return 0; return 0;
} }
if (! symbol->isFunction()) { if (!symbol->isFunction()) {
error(line, "function name expected", call->getName().c_str(), ""); error(line, "function name expected", call->getName().c_str(), "");
return 0; return 0;
} }
const TFunction* function = static_cast<const TFunction*>(symbol); return static_cast<const TFunction*>(symbol);
return function;
} }
// //
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment