-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11338 from ethereum/yulhexvalue
Properly treat utf8-non-encodable yul literals.
- Loading branch information
Showing
8 changed files
with
321 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
{ | ||
"absolutePath": "a", | ||
"exportedSymbols": | ||
{ | ||
"Sample": | ||
[ | ||
6 | ||
] | ||
}, | ||
"id": 7, | ||
"nodeType": "SourceUnit", | ||
"nodes": | ||
[ | ||
{ | ||
"abstract": false, | ||
"baseContracts": [], | ||
"contractDependencies": [], | ||
"contractKind": "contract", | ||
"fullyImplemented": true, | ||
"id": 6, | ||
"linearizedBaseContracts": | ||
[ | ||
6 | ||
], | ||
"name": "Sample", | ||
"nameLocation": "9:6:1", | ||
"nodeType": "ContractDefinition", | ||
"nodes": | ||
[ | ||
{ | ||
"body": | ||
{ | ||
"id": 4, | ||
"nodeType": "Block", | ||
"src": "47:167:1", | ||
"statements": | ||
[ | ||
{ | ||
"AST": | ||
{ | ||
"nodeType": "YulBlock", | ||
"src": "66:142:1", | ||
"statements": | ||
[ | ||
{ | ||
"nodeType": "YulVariableDeclaration", | ||
"src": "80:15:1", | ||
"value": | ||
{ | ||
"hexValue": "74657374", | ||
"kind": "string", | ||
"nodeType": "YulLiteral", | ||
"src": "89:6:1", | ||
"type": "", | ||
"value": "test" | ||
}, | ||
"variables": | ||
[ | ||
{ | ||
"name": "a", | ||
"nodeType": "YulTypedName", | ||
"src": "84:1:1", | ||
"type": "" | ||
} | ||
] | ||
}, | ||
{ | ||
"nodeType": "YulVariableDeclaration", | ||
"src": "108:54:1", | ||
"value": | ||
{ | ||
"hexValue": "112233445566778899aabbccddeeff6677889900", | ||
"kind": "string", | ||
"nodeType": "YulLiteral", | ||
"src": "117:45:1", | ||
"type": "" | ||
}, | ||
"variables": | ||
[ | ||
{ | ||
"name": "b", | ||
"nodeType": "YulTypedName", | ||
"src": "112:1:1", | ||
"type": "" | ||
} | ||
] | ||
}, | ||
{ | ||
"nodeType": "YulVariableDeclaration", | ||
"src": "175:23:1", | ||
"value": | ||
{ | ||
"hexValue": "1234abcd", | ||
"kind": "string", | ||
"nodeType": "YulLiteral", | ||
"src": "184:14:1", | ||
"type": "" | ||
}, | ||
"variables": | ||
[ | ||
{ | ||
"name": "c", | ||
"nodeType": "YulTypedName", | ||
"src": "179:1:1", | ||
"type": "" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"evmVersion": %EVMVERSION%, | ||
"externalReferences": [], | ||
"id": 3, | ||
"nodeType": "InlineAssembly", | ||
"src": "57:151:1" | ||
} | ||
] | ||
}, | ||
"functionSelector": "26121ff0", | ||
"id": 5, | ||
"implemented": true, | ||
"kind": "function", | ||
"modifiers": [], | ||
"name": "f", | ||
"nameLocation": "31:1:1", | ||
"nodeType": "FunctionDefinition", | ||
"parameters": | ||
{ | ||
"id": 1, | ||
"nodeType": "ParameterList", | ||
"parameters": [], | ||
"src": "32:2:1" | ||
}, | ||
"returnParameters": | ||
{ | ||
"id": 2, | ||
"nodeType": "ParameterList", | ||
"parameters": [], | ||
"src": "47:0:1" | ||
}, | ||
"scope": 6, | ||
"src": "22:192:1", | ||
"stateMutability": "pure", | ||
"virtual": false, | ||
"visibility": "public" | ||
} | ||
], | ||
"scope": 7, | ||
"src": "0:216:1", | ||
"usedErrors": [] | ||
} | ||
], | ||
"src": "0:217:1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
contract Sample { | ||
function f() public pure { | ||
assembly { | ||
let a := "test" | ||
let b := hex"112233445566778899aabbccddeeff6677889900" | ||
let c := hex"1234_abcd" | ||
} | ||
} | ||
} | ||
|
||
// ---- |
139 changes: 139 additions & 0 deletions
139
test/libsolidity/ASTJSON/yul_hex_literal_parseOnly.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
{ | ||
"absolutePath": "a", | ||
"id": 7, | ||
"nodeType": "SourceUnit", | ||
"nodes": | ||
[ | ||
{ | ||
"abstract": false, | ||
"baseContracts": [], | ||
"contractDependencies": [], | ||
"contractKind": "contract", | ||
"id": 6, | ||
"name": "Sample", | ||
"nameLocation": "9:6:1", | ||
"nodeType": "ContractDefinition", | ||
"nodes": | ||
[ | ||
{ | ||
"body": | ||
{ | ||
"id": 4, | ||
"nodeType": "Block", | ||
"src": "47:167:1", | ||
"statements": | ||
[ | ||
{ | ||
"AST": | ||
{ | ||
"nodeType": "YulBlock", | ||
"src": "66:142:1", | ||
"statements": | ||
[ | ||
{ | ||
"nodeType": "YulVariableDeclaration", | ||
"src": "80:15:1", | ||
"value": | ||
{ | ||
"hexValue": "74657374", | ||
"kind": "string", | ||
"nodeType": "YulLiteral", | ||
"src": "89:6:1", | ||
"type": "", | ||
"value": "test" | ||
}, | ||
"variables": | ||
[ | ||
{ | ||
"name": "a", | ||
"nodeType": "YulTypedName", | ||
"src": "84:1:1", | ||
"type": "" | ||
} | ||
] | ||
}, | ||
{ | ||
"nodeType": "YulVariableDeclaration", | ||
"src": "108:54:1", | ||
"value": | ||
{ | ||
"hexValue": "112233445566778899aabbccddeeff6677889900", | ||
"kind": "string", | ||
"nodeType": "YulLiteral", | ||
"src": "117:45:1", | ||
"type": "" | ||
}, | ||
"variables": | ||
[ | ||
{ | ||
"name": "b", | ||
"nodeType": "YulTypedName", | ||
"src": "112:1:1", | ||
"type": "" | ||
} | ||
] | ||
}, | ||
{ | ||
"nodeType": "YulVariableDeclaration", | ||
"src": "175:23:1", | ||
"value": | ||
{ | ||
"hexValue": "1234abcd", | ||
"kind": "string", | ||
"nodeType": "YulLiteral", | ||
"src": "184:14:1", | ||
"type": "" | ||
}, | ||
"variables": | ||
[ | ||
{ | ||
"name": "c", | ||
"nodeType": "YulTypedName", | ||
"src": "179:1:1", | ||
"type": "" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"evmVersion": %EVMVERSION%, | ||
"externalReferences": [], | ||
"id": 3, | ||
"nodeType": "InlineAssembly", | ||
"src": "57:151:1" | ||
} | ||
] | ||
}, | ||
"id": 5, | ||
"implemented": true, | ||
"kind": "function", | ||
"modifiers": [], | ||
"name": "f", | ||
"nameLocation": "31:1:1", | ||
"nodeType": "FunctionDefinition", | ||
"parameters": | ||
{ | ||
"id": 1, | ||
"nodeType": "ParameterList", | ||
"parameters": [], | ||
"src": "32:2:1" | ||
}, | ||
"returnParameters": | ||
{ | ||
"id": 2, | ||
"nodeType": "ParameterList", | ||
"parameters": [], | ||
"src": "47:0:1" | ||
}, | ||
"src": "22:192:1", | ||
"stateMutability": "pure", | ||
"virtual": false, | ||
"visibility": "public" | ||
} | ||
], | ||
"src": "0:216:1", | ||
"usedErrors": [] | ||
} | ||
], | ||
"src": "0:217:1" | ||
} |