Make function block scope variables go out of scope

This commit is contained in:
Bhargava Shastry 2019-11-07 11:07:38 +01:00
parent fba2f0a4ca
commit 1a7bd4681a
2 changed files with 12 additions and 3 deletions

View File

@ -1166,8 +1166,18 @@ void ProtoConverter::closeBlockScope()
if (!m_scopeFuncs.empty())
m_scopeFuncs.pop_back();
if (!m_inFunctionDef)
{
if (!m_variables.empty())
m_variables.pop_back();
}
else
{
// Variables that have been declared in a
// function block, go out of scope
if (!m_funcVars.empty())
if (!m_funcVars.back().empty())
m_funcVars.back().pop_back();
}
}
void ProtoConverter::closeFunctionScope()

View File

@ -55,8 +55,7 @@ void printErrors(ostream& _stream, ErrorList const& _errors)
DEFINE_PROTO_FUZZER(Program const& _input)
{
ProtoConverter converter;
string yul_source = converter.programToString(_input);
string yul_source = ProtoConverter().programToString(_input);
if (const char* dump_path = getenv("PROTO_FUZZER_DUMP_PATH"))
{
@ -82,7 +81,7 @@ DEFINE_PROTO_FUZZER(Program const& _input)
!stack.parserResult()->analysisInfo)
{
printErrors(std::cout, stack.errors());
return;
yulAssert(false, "Proto fuzzer generated malformed program");
}
}
catch (Exception const&)