mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Allow hex string literals in Yul.
This commit is contained in:
@@ -6,4 +6,3 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 3772: (72-81): Hex literals are not valid in this context.
|
||||
|
||||
@@ -6,4 +6,3 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 3772: (67-76): Hex literals are not valid in this context.
|
||||
|
||||
@@ -8,4 +8,3 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 3772: (92-99): Hex literals are not valid in this context.
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
assembly {
|
||||
let x := hex"12__34";
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 1465: (84-92): Illegal token: Invalid use of number separator '_'.
|
||||
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
assembly {
|
||||
let x := hex"abxy";
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 1465: (84-90): Illegal token: Expected even number of hex-nibbles.
|
||||
@@ -0,0 +1,5 @@
|
||||
function g() pure {
|
||||
assembly { let hex := 1 }
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (39-42): Expected identifier but got 'ILLEGAL'
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
let x := hex"112233445566778899aabbccddeeff6677889900"
|
||||
let y := hex"1234_abcd"
|
||||
sstore(0, x)
|
||||
sstore(1, y)
|
||||
}
|
||||
// ----
|
||||
// Trace:
|
||||
// Memory dump:
|
||||
// Storage dump:
|
||||
// 0000000000000000000000000000000000000000000000000000000000000000: 112233445566778899aabbccddeeff6677889900000000000000000000000000
|
||||
// 0000000000000000000000000000000000000000000000000000000000000001: 1234abcd00000000000000000000000000000000000000000000000000000000
|
||||
@@ -2,4 +2,3 @@
|
||||
let x := hex"0011"
|
||||
}
|
||||
// ----
|
||||
// ParserError 3772: (15-24): Hex literals are not valid in this context.
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
let x := hex"00110011001100110011001100110011001100110011001100110011001100110011001100110011"
|
||||
}
|
||||
// ----
|
||||
// TypeError 3069: (15-100): String literal too long (40 > 32)
|
||||
@@ -2,4 +2,3 @@
|
||||
pop(hex"2233")
|
||||
}
|
||||
// ----
|
||||
// ParserError 3772: (10-19): Hex literals are not valid in this context.
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
let name := hex"abc"
|
||||
}
|
||||
// ====
|
||||
// dialect: evm
|
||||
// ----
|
||||
// ParserError 1465: (18-24): Illegal token: Expected even number of hex-nibbles.
|
||||
@@ -4,4 +4,3 @@
|
||||
case hex"1122" {}
|
||||
}
|
||||
// ----
|
||||
// ParserError 3772: (33-40): Hex literals are not valid in this context.
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
switch codesize()
|
||||
case hex"00" {}
|
||||
case hex"112233445566778899001122334455667788990011223344556677889900112233445566778899001122334455667788990011223344556677889900" {}
|
||||
}
|
||||
// ----
|
||||
// TypeError 3069: (53-178): String literal too long (60 > 32)
|
||||
Reference in New Issue
Block a user