mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Update control flow graph.
This commit is contained in:
parent
f627dc77d0
commit
1cbc037a45
@ -159,15 +159,14 @@ bool ControlFlowBuilder::visit(WhileStatement const& _whileStatement)
|
|||||||
{
|
{
|
||||||
auto afterWhile = newLabel();
|
auto afterWhile = newLabel();
|
||||||
auto whileBody = createLabelHere();
|
auto whileBody = createLabelHere();
|
||||||
|
auto condition = newLabel();
|
||||||
|
|
||||||
{
|
{
|
||||||
// Note that "continue" in this case currently indeed jumps to whileBody
|
BreakContinueScope scope(*this, afterWhile, condition);
|
||||||
// and not to the condition. This is inconsistent with JavaScript and C and
|
|
||||||
// therefore a bug. This will be fixed in the future (planned for 0.5.0)
|
|
||||||
// and the Control Flow Graph will have to be adjusted accordingly.
|
|
||||||
BreakContinueScope scope(*this, afterWhile, whileBody);
|
|
||||||
appendControlFlow(_whileStatement.body());
|
appendControlFlow(_whileStatement.body());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
placeAndConnectLabel(condition);
|
||||||
appendControlFlow(_whileStatement.condition());
|
appendControlFlow(_whileStatement.condition());
|
||||||
|
|
||||||
connect(m_currentNode, whileBody);
|
connect(m_currentNode, whileBody);
|
||||||
|
@ -23,13 +23,8 @@ contract C {
|
|||||||
}
|
}
|
||||||
function k() internal view returns (S storage c) {
|
function k() internal view returns (S storage c) {
|
||||||
do {
|
do {
|
||||||
if (s.f) {
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
c = s;
|
c = s;
|
||||||
}
|
continue;
|
||||||
} while(false);
|
} while(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,15 @@ contract C {
|
|||||||
do {
|
do {
|
||||||
if (s.f) {
|
if (s.f) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
c = s;
|
||||||
|
}
|
||||||
|
} while(false);
|
||||||
|
}
|
||||||
|
function i() internal view returns (S storage c) {
|
||||||
|
do {
|
||||||
|
if (s.f) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -28,8 +37,16 @@ contract C {
|
|||||||
}
|
}
|
||||||
} while(false);
|
} while(false);
|
||||||
}
|
}
|
||||||
|
function j() internal view returns (S storage c) {
|
||||||
|
do {
|
||||||
|
continue;
|
||||||
|
c = s;
|
||||||
|
} while(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
// Warning: (87-98): This variable is of storage pointer type and might be returned without assignment. This can cause storage corruption. Assign the variable (potentially from itself) to remove this warning.
|
// Warning: (87-98): This variable is of storage pointer type and might be returned without assignment. This can cause storage corruption. Assign the variable (potentially from itself) to remove this warning.
|
||||||
// Warning: (223-234): This variable is of storage pointer type and might be returned without assignment. This can cause storage corruption. Assign the variable (potentially from itself) to remove this warning.
|
// Warning: (223-234): This variable is of storage pointer type and might be returned without assignment. This can cause storage corruption. Assign the variable (potentially from itself) to remove this warning.
|
||||||
// Warning: (440-451): This variable is of storage pointer type and might be returned without assignment. This can cause storage corruption. Assign the variable (potentially from itself) to remove this warning.
|
// Warning: (440-451): This variable is of storage pointer type and might be returned without assignment. This can cause storage corruption. Assign the variable (potentially from itself) to remove this warning.
|
||||||
|
// Warning: (654-665): This variable is of storage pointer type and might be returned without assignment. This can cause storage corruption. Assign the variable (potentially from itself) to remove this warning.
|
||||||
|
// Warning: (871-882): This variable is of storage pointer type and might be returned without assignment. This can cause storage corruption. Assign the variable (potentially from itself) to remove this warning.
|
||||||
|
Loading…
Reference in New Issue
Block a user