Use locationOf helper instead of accessing debugData directly.

This commit is contained in:
Daniel Kirchner
2021-09-14 10:04:09 +02:00
parent 8fafdeacac
commit 7abc55d89a
6 changed files with 99 additions and 113 deletions
+3 -3
View File
@@ -53,7 +53,7 @@ bool ScopeFiller::operator()(ExpressionStatement const& _expr)
bool ScopeFiller::operator()(VariableDeclaration const& _varDecl)
{
for (auto const& variable: _varDecl.variables)
if (!registerVariable(variable, _varDecl.debugData->location, *m_currentScope))
if (!registerVariable(variable, locationOf(_varDecl), *m_currentScope))
return false;
return true;
}
@@ -68,7 +68,7 @@ bool ScopeFiller::operator()(FunctionDefinition const& _funDef)
bool success = true;
for (auto const& var: _funDef.parameters + _funDef.returnVariables)
if (!registerVariable(var, _funDef.debugData->location, varScope))
if (!registerVariable(var, locationOf(_funDef), varScope))
success = false;
if (!(*this)(_funDef.body))
@@ -162,7 +162,7 @@ bool ScopeFiller::registerFunction(FunctionDefinition const& _funDef)
//@TODO secondary location
m_errorReporter.declarationError(
6052_error,
_funDef.debugData->location,
locationOf(_funDef),
"Function name " + _funDef.name.str() + " already taken in this scope."
);
return false;