Move modifier context check to PostTypeChecker

refs #7566
This commit is contained in:
Mathias Baumann
2020-01-08 14:05:08 +01:00
committed by chriseth
parent 5ad590cf0b
commit 9f8d49e358
4 changed files with 52 additions and 18 deletions
+1 -14
View File
@@ -547,11 +547,7 @@ void TypeChecker::visitManually(
for (ASTPointer<Expression> const& argument: arguments)
argument->accept(*this);
{
m_insideModifierInvocation = true;
ScopeGuard resetFlag{[&] () { m_insideModifierInvocation = false; }};
_modifier.name()->accept(*this);
}
_modifier.name()->accept(*this);
auto const* declaration = &dereference(*_modifier.name());
vector<ASTPointer<VariableDeclaration>> emptyParameterList;
@@ -2704,15 +2700,6 @@ bool TypeChecker::visit(Identifier const& _identifier)
);
}
if (!m_insideModifierInvocation)
if (ModifierType const* type = dynamic_cast<decltype(type)>(_identifier.annotation().type))
{
m_errorReporter.typeError(
_identifier.location(),
"Modifier can only be referenced in function headers."
);
}
return false;
}