Give error for calling a user-defined function at global scope.
This commit is contained in:
parent
894c1c109f
commit
820a22fcc8
5 changed files with 32 additions and 6 deletions
|
|
@ -1124,7 +1124,10 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction
|
|||
// if builtIn == true, it's definitely a built-in function with EOpNull
|
||||
if (! builtIn) {
|
||||
call->setUserDefined();
|
||||
intermediate.addToCallGraph(infoSink, currentCaller, fnCandidate->getMangledName());
|
||||
if (symbolTable.atGlobalLevel())
|
||||
error(loc, "can't call user function from global scope", fnCandidate->getName().c_str(), "");
|
||||
else
|
||||
intermediate.addToCallGraph(infoSink, currentCaller, fnCandidate->getMangledName());
|
||||
}
|
||||
|
||||
if (builtIn)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue