31 lines
549 B
Plaintext
31 lines
549 B
Plaintext
// Slot indices follow declaration order, not first-use order.
|
|
uint first = 1;
|
|
uint second = 2;
|
|
second = second + 1;
|
|
first = first + second;
|
|
if (first != 4)
|
|
exit(1);
|
|
|
|
// Shadowed locals use distinct slots in distinct environments.
|
|
uint value = 10;
|
|
{
|
|
uint value = 20;
|
|
value = value + 1;
|
|
if (value != 21)
|
|
exit(1);
|
|
}
|
|
if (value != 10)
|
|
exit(1);
|
|
|
|
// Access an outer local from nested loop/body scopes.
|
|
uint total = 0;
|
|
for (uint i = 0; i < 4; i = i + 1)
|
|
{
|
|
{
|
|
uint nested = i;
|
|
total = total + nested;
|
|
}
|
|
}
|
|
if (total != 6)
|
|
exit(1);
|