mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 09:15:38 +00:00
ignore unused explicit references for functions
This commit is contained in:
parent
6e2e4d1adf
commit
a85d3c7dcb
4 changed files with 25 additions and 7 deletions
|
@ -397,8 +397,15 @@ namespace Compiler
|
|||
char returnType;
|
||||
std::string argumentType;
|
||||
|
||||
if (extensions->isFunction (keyword, returnType, argumentType, true))
|
||||
bool hasExplicit = true;
|
||||
if (extensions->isFunction (keyword, returnType, argumentType, hasExplicit))
|
||||
{
|
||||
if (!hasExplicit)
|
||||
{
|
||||
getErrorHandler().warning ("stray explicit reference (ignoring it)", loc);
|
||||
mExplicit.clear();
|
||||
}
|
||||
|
||||
start();
|
||||
|
||||
mTokenLoc = loc;
|
||||
|
@ -519,7 +526,9 @@ namespace Compiler
|
|||
char returnType;
|
||||
std::string argumentType;
|
||||
|
||||
if (extensions->isFunction (keyword, returnType, argumentType, false))
|
||||
bool hasExplicit = false;
|
||||
|
||||
if (extensions->isFunction (keyword, returnType, argumentType, hasExplicit))
|
||||
{
|
||||
mTokenLoc = loc;
|
||||
int optionals = parseArguments (argumentType, scanner);
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace Compiler
|
|||
}
|
||||
|
||||
bool Extensions::isFunction (int keyword, char& returnType, std::string& argumentType,
|
||||
bool explicitReference) const
|
||||
bool& explicitReference) const
|
||||
{
|
||||
std::map<int, Function>::const_iterator iter = mFunctions.find (keyword);
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace Compiler
|
|||
return false;
|
||||
|
||||
if (explicitReference && iter->second.mCodeExplicit==-1)
|
||||
return false;
|
||||
explicitReference = false;
|
||||
|
||||
returnType = iter->second.mReturn;
|
||||
argumentType = iter->second.mArguments;
|
||||
|
|
|
@ -47,9 +47,11 @@ namespace Compiler
|
|||
/// - keyword must be all lower case.
|
||||
|
||||
bool isFunction (int keyword, char& returnType, std::string& argumentType,
|
||||
bool explicitReference) const;
|
||||
bool& explicitReference) const;
|
||||
///< Is this keyword registered with a function? If yes, return return and argument
|
||||
/// types.
|
||||
/// \param explicitReference In: has explicit reference; Out: set to false, if
|
||||
/// explicit reference is not available for this instruction.
|
||||
|
||||
bool isInstruction (int keyword, std::string& argumentType,
|
||||
bool& explicitReference) const;
|
||||
|
|
|
@ -279,9 +279,16 @@ namespace Compiler
|
|||
char returnType;
|
||||
std::string argumentType;
|
||||
|
||||
if (extensions->isFunction (keyword, returnType, argumentType,
|
||||
!mExplicit.empty()))
|
||||
bool hasExplicit = !mExplicit.empty();
|
||||
|
||||
if (extensions->isFunction (keyword, returnType, argumentType, hasExplicit))
|
||||
{
|
||||
if (!hasExplicit && !mExplicit.empty())
|
||||
{
|
||||
getErrorHandler().warning ("stray explicit reference (ignoring it)", loc);
|
||||
mExplicit.clear();
|
||||
}
|
||||
|
||||
scanner.putbackKeyword (keyword, loc);
|
||||
parseExpression (scanner, loc);
|
||||
mState = EndState;
|
||||
|
|
Loading…
Reference in a new issue