mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Tests for basefee as identifier in inline assembly
Also added basefee to `EVMVersion::hasOpcode(...)`
This commit is contained in:
parent
7f1a2be0fe
commit
892700d769
@ -46,8 +46,9 @@ bool EVMVersion::hasOpcode(Instruction _opcode) const
|
||||
return hasChainID();
|
||||
case Instruction::SELFBALANCE:
|
||||
return hasSelfBalance();
|
||||
case Instruction::BASEFEE:
|
||||
return hasBaseFee();
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,9 @@ done < <(
|
||||
grep -v -E 'literals/.*_direction_override.*.sol' |
|
||||
# Skipping a test with "revert E;" because ANTLR cannot distinguish it from
|
||||
# a variable declaration.
|
||||
grep -v -E 'revertStatement/non_called.sol'
|
||||
grep -v -E 'revertStatement/non_called.sol' |
|
||||
# Skipping a test with "let basefee := ..."
|
||||
grep -v -E 'inlineAssembly/basefee_berlin_function.sol'
|
||||
)
|
||||
|
||||
YUL_FILES=()
|
||||
|
@ -0,0 +1,22 @@
|
||||
contract C {
|
||||
function f() public view returns (uint ret) {
|
||||
assembly {
|
||||
let basefee := sload(0)
|
||||
ret := basefee
|
||||
}
|
||||
}
|
||||
function g() public pure returns (uint ret) {
|
||||
assembly {
|
||||
function basefee() -> r {
|
||||
r := 1000
|
||||
}
|
||||
ret := basefee()
|
||||
}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// EVMVersion: <=berlin
|
||||
// ----
|
||||
// f() -> 0
|
||||
// g() -> 1000
|
@ -0,0 +1,12 @@
|
||||
contract C {
|
||||
function f() public view returns (uint ret) {
|
||||
assembly {
|
||||
let basefee := sload(0)
|
||||
ret := basefee
|
||||
}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: =london
|
||||
// ----
|
||||
// ParserError 5568: (98-105): Cannot use builtin function name "basefee" as identifier name.
|
Loading…
Reference in New Issue
Block a user