Add Yul syntax test for every Solidity keyword

This commit is contained in:
Alex Beregszaszi 2020-07-29 14:40:34 +01:00
parent 4366ede889
commit 26a76c18d4
2 changed files with 222 additions and 0 deletions

View File

@ -0,0 +1,113 @@
contract C {
function f() view public {
assembly {
// These are keywords of Solidity -- a copy from liblangutil/Token.h.
let abstract := 1
let anonymous := 1
let as := 1
let assembly := 1
// break is Yul keyword
let catch := 1
let constant := 1
let constructor := 1
// continue is Yul keyword
let contract := 1
let do := 1
let else := 1
let enum := 1
let emit := 1
let event := 1
let external := 1
let fallback := 1
// for is a Yul keyword
// function is a Yul keyword
let hex := 1
// if is a Yul keyword
let indexed := 1
let interface := 1
let internal := 1
let immutable := 1
let import := 1
let is := 1
let library := 1
let mapping := 1
let memory := 1
let modifier := 1
let new := 1
let override := 1
let payable := 1
let public := 1
let pragma := 1
let private := 1
let pure := 1
let receive := 1
// return is a builtin in EVMDialect
return(0, 0)
let returns := 1
let storage := 1
let calldata := 1
let struct := 1
let throw := 1
let try := 1
// type shadows the Solidity function
let unicode := 1
let using := 1
let view := 1
let virtual := 1
let while := 1
let wei := 1
let gwei := 1
let ether := 1
let seconds := 1
let minutes := 1
let hours := 1
let days := 1
let weeks := 1
let years := 1
let int := 1
let uint := 1
let bytes := 1
// byte is a builtin in EVMDialect
pop(byte(1, 1))
let string := 1
// address is a builtin in EVMDialect
pop(address())
let bool := 1
let fixed := 1
let ufixed := 1
let after := 1
let alias := 1
let apply := 1
let auto := 1
// case is a Yul keyword
let copyof := 1
// default is a Yul keyword
let define := 1
let final := 1
let implements := 1
let in := 1
let inline := 1
// let is a Yul keyword
let macro := 1
let match := 1
let mutable := 1
let null := 1
let of := 1
let partial := 1
let promise := 1
let reference := 1
let relocatable := 1
let sealed := 1
let sizeof := 1
let static := 1
let supports := 1
// switch is a Yul keyword
let typedef := 1
let typeof := 1
let unchecked := 1
let var := 1
}
}
}
// ----
// Warning 5740: (944-2157): Unreachable code.

View File

@ -0,0 +1,109 @@
{
// These are keywords of Solidity -- a copy from liblangutil/Token.h.
let abstract := 1
let anonymous := 1
let as := 1
let assembly := 1
// break is Yul keyword
let catch := 1
let constant := 1
let constructor := 1
// continue is Yul keyword
let contract := 1
let do := 1
let else := 1
let enum := 1
let emit := 1
let event := 1
let external := 1
let fallback := 1
// for is a Yul keyword
// function is a Yul keyword
let hex := 1
// if is a Yul keyword
let indexed := 1
let interface := 1
let internal := 1
let immutable := 1
let import := 1
let is := 1
let library := 1
let mapping := 1
let memory := 1
let modifier := 1
let new := 1
let override := 1
let payable := 1
let public := 1
let pragma := 1
let private := 1
let pure := 1
let receive := 1
// return is a builtin in EVMDialect
return(0, 0)
let returns := 1
let storage := 1
let calldata := 1
let struct := 1
let throw := 1
let try := 1
let type := 1
let unicode := 1
let using := 1
let view := 1
let virtual := 1
let while := 1
let wei := 1
let gwei := 1
let ether := 1
let seconds := 1
let minutes := 1
let hours := 1
let days := 1
let weeks := 1
let years := 1
let int := 1
let uint := 1
let bytes := 1
// byte is a builtin in EVMDialect
pop(byte(1, 1))
let string := 1
// address is a builtin in EVMDialect
pop(address())
let bool := 1
let fixed := 1
let ufixed := 1
let after := 1
let alias := 1
let apply := 1
let auto := 1
// case is a Yul keyword
let copyof := 1
// default is a Yul keyword
let define := 1
let final := 1
let implements := 1
let in := 1
let inline := 1
// let is a Yul keyword
let macro := 1
let match := 1
let mutable := 1
let null := 1
let of := 1
let partial := 1
let promise := 1
let reference := 1
let relocatable := 1
let sealed := 1
let sizeof := 1
let static := 1
let supports := 1
// switch is a Yul keyword
let typedef := 1
let typeof := 1
let unchecked := 1
let var := 1
}
// ====
// dialect: evm