mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #10550 from ethereum/chainIdView
[BREAKING] Mark chainid as view.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
contract C {
|
||||
function f() pure external returns (uint id) {
|
||||
function f() view external returns (uint id) {
|
||||
assembly {
|
||||
id := chainid()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
assembly { pop(chainid()) }
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=istanbul
|
||||
// ----
|
||||
// TypeError 2527: (67-76): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
@@ -1,5 +1,5 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
function f() public view {
|
||||
assembly { pop(chainid()) }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user