Undo backwards-compatibly change that prevents external identifer resolving.

This commit is contained in:
chriseth 2021-08-12 14:47:30 +02:00
parent 0755d65e80
commit 838514a718
3 changed files with 2 additions and 33 deletions

View File

@ -744,13 +744,6 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly)
bool bool
) -> bool ) -> bool
{ {
if (_context == yul::IdentifierContext::NonExternal)
{
// Hack until we can disallow any shadowing: If we found an internal reference,
// clear the external references, so that codegen does not use it.
_inlineAssembly.annotation().externalReferences.erase(& _identifier);
return false;
}
auto ref = _inlineAssembly.annotation().externalReferences.find(&_identifier); auto ref = _inlineAssembly.annotation().externalReferences.find(&_identifier);
if (ref == _inlineAssembly.annotation().externalReferences.end()) if (ref == _inlineAssembly.annotation().externalReferences.end())
return false; return false;

View File

@ -146,13 +146,6 @@ vector<YulString> AsmAnalyzer::operator()(Identifier const& _identifier)
} }
})) }))
{ {
if (m_resolver)
// We found a local reference, make sure there is no external reference.
m_resolver(
_identifier,
yul::IdentifierContext::NonExternal,
m_currentScope->insideFunction()
);
} }
else else
{ {
@ -315,7 +308,7 @@ vector<YulString> AsmAnalyzer::operator()(FunctionCall const& _funCall)
validateInstructions(_funCall); validateInstructions(_funCall);
} }
else if (m_currentScope->lookup(_funCall.functionName.name, GenericVisitor{ else if (!m_currentScope->lookup(_funCall.functionName.name, GenericVisitor{
[&](Scope::Variable const&) [&](Scope::Variable const&)
{ {
m_errorReporter.typeError( m_errorReporter.typeError(
@ -330,15 +323,6 @@ vector<YulString> AsmAnalyzer::operator()(FunctionCall const& _funCall)
returnTypes = &_fun.returns; returnTypes = &_fun.returns;
} }
})) }))
{
if (m_resolver)
// We found a local reference, make sure there is no external reference.
m_resolver(
_funCall.functionName,
yul::IdentifierContext::NonExternal,
m_currentScope->insideFunction()
);
}
else else
{ {
if (!validateInstructions(_funCall)) if (!validateInstructions(_funCall))
@ -556,14 +540,6 @@ void AsmAnalyzer::checkAssignment(Identifier const& _variable, YulString _valueT
bool found = false; bool found = false;
if (Scope::Identifier const* var = m_currentScope->lookup(_variable.name)) if (Scope::Identifier const* var = m_currentScope->lookup(_variable.name))
{ {
if (m_resolver)
// We found a local reference, make sure there is no external reference.
m_resolver(
_variable,
yul::IdentifierContext::NonExternal,
m_currentScope->insideFunction()
);
if (!holds_alternative<Scope::Variable>(*var)) if (!holds_alternative<Scope::Variable>(*var))
m_errorReporter.typeError(2657_error, _variable.debugData->location, "Assignment requires variable."); m_errorReporter.typeError(2657_error, _variable.debugData->location, "Assignment requires variable.");
else if (!m_activeVariables.count(&std::get<Scope::Variable>(*var))) else if (!m_activeVariables.count(&std::get<Scope::Variable>(*var)))

View File

@ -117,7 +117,7 @@ public:
virtual void markAsInvalid() = 0; virtual void markAsInvalid() = 0;
}; };
enum class IdentifierContext { LValue, RValue, VariableDeclaration, NonExternal }; enum class IdentifierContext { LValue, RValue, VariableDeclaration };
/// Object that is used to resolve references and generate code for access to identifiers external /// Object that is used to resolve references and generate code for access to identifiers external
/// to inline assembly (not used in standalone assembly mode). /// to inline assembly (not used in standalone assembly mode).