mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
35 lines
786 B
Solidity
35 lines
786 B
Solidity
contract test {
|
|
struct topStruct {
|
|
nestedStruct nstr;
|
|
uint topValue;
|
|
}
|
|
uint toDelete;
|
|
topStruct str;
|
|
struct nestedStruct {
|
|
uint nestedValue;
|
|
}
|
|
constructor() {
|
|
toDelete = 5;
|
|
str.topValue = 1;
|
|
|
|
str.nstr.nestedValue = 2;
|
|
delete str;
|
|
delete toDelete;
|
|
}
|
|
function getToDelete() public returns (uint res){
|
|
res = toDelete;
|
|
}
|
|
function getTopValue() public returns(uint topValue){
|
|
topValue = str.topValue;
|
|
}
|
|
function getNestedValue() public returns(uint nestedValue){
|
|
nestedValue = str.nstr.nestedValue;
|
|
}
|
|
}
|
|
// ====
|
|
// compileViaYul: also
|
|
// ----
|
|
// getToDelete() -> 0
|
|
// getTopValue() -> 0
|
|
// getNestedValue() -> 0 #mapping values should be the same#
|