Revert "Names of built-in functions cannot be redeclared as functions"
Causing failures in the WebGL1 test: conformance/glsl/misc/shader-with-non-reserved-words.html
This reverts commit b5f88853ea80ea112368bb15999b363db0e4c648.
Change-Id: I2105c8040057665abda00435e8c0ff8a83af3645
Reviewed-on: https://chromium-review.googlesource.com/289192
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index 5a624d0..6ed92ec 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -2009,26 +2009,18 @@
TFunction *TParseContext::parseFunctionDeclarator(const TSourceLoc &location, TFunction *function)
{
- TFunction *prevDec = static_cast<TFunction*>(symbolTable.find(function->getMangledName(), getShaderVersion()));
- bool builtIn;
- TSymbol *prevSym = symbolTable.find(function->getName(), getShaderVersion(), &builtIn);
- if (getShaderVersion() >= 300 && prevSym && builtIn)
+ //
+ // Multiple declarations of the same function are allowed.
+ //
+ // If this is a definition, the definition production code will check for redefinitions
+ // (we don't know at this point if it's a definition or not).
+ //
+ // Redeclarations are allowed. But, return types and parameter qualifiers must match.
+ //
+ TFunction *prevDec =
+ static_cast<TFunction *>(symbolTable.find(function->getMangledName(), getShaderVersion()));
+ if (prevDec)
{
- // With ESSL 3.00, names of built-in functions cannot be redeclared as functions.
- // Therefore overloading or redefining builtin functions is an error.
- error(location, "Name of a built-in function cannot be redeclared as function", function->getName().c_str());
- recover();
- }
- else if (prevDec)
- {
- //
- // Multiple declarations of the same function are allowed.
- //
- // If this is a definition, the definition production code will check for redefinitions
- // (we don't know at this point if it's a definition or not).
- //
- // Redeclarations are allowed. But, return types and parameter qualifiers must match.
- //
if (prevDec->getReturnType() != function->getReturnType())
{
error(location, "overloaded functions must have the same return type",
@@ -2050,6 +2042,7 @@
//
// Check for previously declared variables using the same name.
//
+ TSymbol *prevSym = symbolTable.find(function->getName(), getShaderVersion());
if (prevSym)
{
if (!prevSym->isFunction())