Add more tests to ViewPureChecker

This commit is contained in:
Alex Beregszaszi 2020-10-02 11:37:13 +01:00
parent 875dc0f10c
commit 32cb5207b3
6 changed files with 32 additions and 2 deletions

View File

@ -0,0 +1,8 @@
contract C {
function f() public view returns (uint) {
return address(this).balance;
}
function g() public view returns (uint) {
return address(0).balance;
}
}

View File

@ -14,10 +14,16 @@ contract C {
function h() view public {
assembly { function g() { pop(blockhash(20)) } }
}
function j() public {
function i() public {
assembly { pop(call(0, 1, 2, 3, 4, 5, 6)) }
}
function k() public {
function j() public {
assembly { pop(call(gas(), 1, 2, 3, 4, 5, 6)) }
}
function k() public view {
assembly { pop(balance(0)) }
}
function l() public view {
assembly { pop(extcodesize(0)) }
}
}

View File

@ -0,0 +1,8 @@
contract C {
function f() public view {
assembly { pop(extcodehash(0)) }
}
}
// ====
// EVMVersion: >=constantinople
// ----

View File

@ -0,0 +1,8 @@
contract C {
function f() public pure {
assembly { pop(chainid()) }
}
}
// ====
// EVMVersion: >=istanbul
// ----