mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix for rematerializer.
This commit is contained in:
parent
22c4d282aa
commit
e100af592b
@ -136,6 +136,10 @@ void Rematerialiser::handleAssignment(set<string> const& _variables, Expression*
|
|||||||
else
|
else
|
||||||
m_substitutions.erase(name);
|
m_substitutions.erase(name);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
for (auto const& name: _variables)
|
||||||
|
m_substitutions.erase(name);
|
||||||
|
|
||||||
// Disallow substitutions that use a variable that will be reassigned by this assignment.
|
// Disallow substitutions that use a variable that will be reassigned by this assignment.
|
||||||
for (auto const& name: _variables)
|
for (auto const& name: _variables)
|
||||||
for (auto const& ref: m_referencedBy[name])
|
for (auto const& ref: m_referencedBy[name])
|
||||||
|
@ -118,6 +118,18 @@ BOOST_AUTO_TEST_CASE(branches_for)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(branches_for_declared_in_init)
|
||||||
|
{
|
||||||
|
CHECK(
|
||||||
|
"{ let b := 0 for { let a := 1 pop(a) } a { pop(a) } { b := 1 pop(a) } }",
|
||||||
|
"{ let b := 0 for { let a := 1 pop(1) } 1 { pop(1) } { b := 1 pop(1) } }"
|
||||||
|
);
|
||||||
|
CHECK(
|
||||||
|
"{ let b := 0 for { let a := 1 pop(a) } lt(a, 0) { pop(a) a := add(a, 3) } { b := 1 pop(a) } }",
|
||||||
|
"{ let b := 0 for { let a := 1 pop(1) } lt(a, 0) { pop(a) a := add(a, 3) } { b := 1 pop(a) } }"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(reassignment)
|
BOOST_AUTO_TEST_CASE(reassignment)
|
||||||
{
|
{
|
||||||
CHECK(
|
CHECK(
|
||||||
|
Loading…
Reference in New Issue
Block a user