Merge remote-tracking branch 'origin/develop' into develop_060

This commit is contained in:
chriseth
2019-11-26 16:19:35 +01:00
65 changed files with 1942 additions and 203 deletions
+8 -8
View File
@@ -82,14 +82,14 @@ void VariableReferenceCounter::operator()(Block const& _block)
void VariableReferenceCounter::increaseRefIfFound(YulString _variableName)
{
m_scope->lookup(_variableName, Scope::Visitor(
m_scope->lookup(_variableName, GenericVisitor{
[=](Scope::Variable const& _var)
{
++m_context.variableReferences[&_var];
},
[=](Scope::Label const&) { },
[=](Scope::Function const&) { }
));
});
}
CodeTransform::CodeTransform(
@@ -283,11 +283,11 @@ void CodeTransform::operator()(FunctionCall const& _call)
}
Scope::Function* function = nullptr;
solAssert(m_scope->lookup(_call.functionName.name, Scope::NonconstVisitor(
solAssert(m_scope->lookup(_call.functionName.name, GenericVisitor{
[=](Scope::Variable&) { solAssert(false, "Expected function name."); },
[=](Scope::Label&) { solAssert(false, "Expected function name."); },
[&](Scope::Function& _function) { function = &_function; }
)), "Function name not found.");
}), "Function name not found.");
solAssert(function, "");
solAssert(function->arguments.size() == _call.arguments.size(), "");
for (auto const& arg: _call.arguments | boost::adaptors::reversed)
@@ -310,7 +310,7 @@ void CodeTransform::operator()(Identifier const& _identifier)
m_assembly.setSourceLocation(_identifier.location);
// First search internals, then externals.
solAssert(m_scope, "");
if (m_scope->lookup(_identifier.name, Scope::NonconstVisitor(
if (m_scope->lookup(_identifier.name, GenericVisitor{
[=](Scope::Variable& _var)
{
// TODO: opportunity for optimization: Do not DUP if this is the last reference
@@ -330,7 +330,7 @@ void CodeTransform::operator()(Identifier const& _identifier)
{
solAssert(false, "Function not removed during desugaring.");
}
)))
}))
{
return;
}
@@ -646,14 +646,14 @@ void CodeTransform::operator()(Block const& _block)
AbstractAssembly::LabelID CodeTransform::labelFromIdentifier(Identifier const& _identifier)
{
AbstractAssembly::LabelID label = AbstractAssembly::LabelID(-1);
if (!m_scope->lookup(_identifier.name, Scope::NonconstVisitor(
if (!m_scope->lookup(_identifier.name, GenericVisitor{
[=](Scope::Variable&) { solAssert(false, "Expected label"); },
[&](Scope::Label& _label)
{
label = labelID(_label);
},
[=](Scope::Function&) { solAssert(false, "Expected label"); }
)))
}))
{
solAssert(false, "Identifier not found.");
}