mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Sol -> Yul Generation: Implicit conversions
This commit is contained in:
committed by
chriseth
parent
6292adbde6
commit
944ac6fb6d
@@ -0,0 +1,14 @@
|
||||
// Tests IRGeneratorForStatements::visit(Assignment const& _assignment)
|
||||
contract C {
|
||||
function f() public pure returns (uint16 x) {
|
||||
uint8 y;
|
||||
assembly {
|
||||
y := 0x12345678
|
||||
}
|
||||
x = y;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// ----
|
||||
// f() -> 0x78
|
||||
@@ -0,0 +1,17 @@
|
||||
// IRGeneratorForStatements::visit(FunctionCall const& _functionCall)
|
||||
contract C {
|
||||
function f(uint b) public pure returns (uint x) {
|
||||
x = b;
|
||||
}
|
||||
function g() public pure returns (uint x) {
|
||||
uint8 a;
|
||||
assembly {
|
||||
a := 0x12345678
|
||||
}
|
||||
x = f(a);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// ----
|
||||
// g() -> 0x78
|
||||
@@ -0,0 +1,13 @@
|
||||
// IRGeneratorForStatements::visit(VariableDeclarationStatement const& _varDeclStatement)
|
||||
contract C {
|
||||
function f() public pure returns (uint y) {
|
||||
uint8 a;
|
||||
assembly { a := 0x12345678 }
|
||||
uint z = a;
|
||||
y = z;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// ----
|
||||
// f() -> 0x78
|
||||
Reference in New Issue
Block a user