Fix source location for `if` statements.

This commit is contained in:
Christian Parpart 2021-06-16 12:38:34 +02:00 committed by chriseth
parent 46514ffad2
commit f9f32c910d
9 changed files with 18 additions and 16 deletions

View File

@ -18,6 +18,7 @@ Bugfixes:
* Type Checker: Fix internal error and prevent static calls to unimplemented modifiers. * Type Checker: Fix internal error and prevent static calls to unimplemented modifiers.
* Yul Code Generator: Fix internal compiler error when using a long literal with bitwise negation. * Yul Code Generator: Fix internal compiler error when using a long literal with bitwise negation.
* Yul Code Generator: Fix source location references for calls to builtin functions. * Yul Code Generator: Fix source location references for calls to builtin functions.
* Yul Parser: Fix source location references for ``if`` statements.
### 0.8.6 (2021-06-22) ### 0.8.6 (2021-06-22)

View File

@ -107,6 +107,7 @@ Statement Parser::parseStatement()
advance(); advance();
_if.condition = make_unique<Expression>(parseExpression()); _if.condition = make_unique<Expression>(parseExpression());
_if.body = parseBlock(); _if.body = parseBlock();
_if.debugData = updateLocationEndFrom(_if.debugData, _if.body.debugData->location);
return Statement{move(_if)}; return Statement{move(_if)};
} }
case Token::Switch: case Token::Switch:

View File

@ -103,7 +103,7 @@
"src": "127:35:1" "src": "127:35:1"
}, },
"nodeType": "YulIf", "nodeType": "YulIf",
"src": "124:2:1" "src": "124:122:1"
}, },
{ {
"nodeType": "YulAssignment", "nodeType": "YulAssignment",
@ -188,7 +188,7 @@
"src": "297:30:1" "src": "297:30:1"
}, },
"nodeType": "YulIf", "nodeType": "YulIf",
"src": "294:2:1" "src": "294:117:1"
}, },
{ {
"nodeType": "YulAssignment", "nodeType": "YulAssignment",
@ -316,7 +316,7 @@
"src": "461:41:1" "src": "461:41:1"
}, },
"nodeType": "YulIf", "nodeType": "YulIf",
"src": "458:2:1" "src": "458:128:1"
} }
] ]
}, },
@ -431,7 +431,7 @@
"src": "712:32:1" "src": "712:32:1"
}, },
"nodeType": "YulIf", "nodeType": "YulIf",
"src": "709:2:1" "src": "709:119:1"
}, },
{ {
"nodeType": "YulBlock", "nodeType": "YulBlock",
@ -542,7 +542,7 @@
"src": "914:30:1" "src": "914:30:1"
}, },
"nodeType": "YulIf", "nodeType": "YulIf",
"src": "911:2:1" "src": "911:117:1"
}, },
{ {
"nodeType": "YulAssignment", "nodeType": "YulAssignment",

View File

@ -162,7 +162,7 @@ sub_0: assembly {
dup3 dup3
/* "#utility.yul":257:270 */ /* "#utility.yul":257:270 */
gt gt
/* "#utility.yul":254:256 */ /* "#utility.yul":254:390 */
iszero iszero
tag_30 tag_30
jumpi jumpi
@ -188,7 +188,7 @@ sub_0: assembly {
0x00 0x00
/* "#utility.yul":365:380 */ /* "#utility.yul":365:380 */
revert revert
/* "#utility.yul":254:256 */ /* "#utility.yul":254:390 */
tag_30: tag_30:
pop pop
/* "#utility.yul":406:415 */ /* "#utility.yul":406:415 */

View File

@ -167,7 +167,7 @@ sub_0: assembly {
dup3 dup3
/* "#utility.yul":257:270 */ /* "#utility.yul":257:270 */
gt gt
/* "#utility.yul":254:256 */ /* "#utility.yul":254:390 */
iszero iszero
tag_26 tag_26
jumpi jumpi
@ -193,7 +193,7 @@ sub_0: assembly {
0x00 0x00
/* "#utility.yul":365:380 */ /* "#utility.yul":365:380 */
revert revert
/* "#utility.yul":254:256 */ /* "#utility.yul":254:390 */
tag_26: tag_26:
pop pop
/* "#utility.yul":406:415 */ /* "#utility.yul":406:415 */

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -36,7 +36,7 @@ Text representation:
mstore mstore
/* "strict_asm_optimizer_steps/input.yul":61:72 */ /* "strict_asm_optimizer_steps/input.yul":61:72 */
callvalue callvalue
/* "strict_asm_optimizer_steps/input.yul":58:60 */ /* "strict_asm_optimizer_steps/input.yul":58:89 */
iszero iszero
tag_1 tag_1
jumpi jumpi
@ -46,7 +46,7 @@ Text representation:
dup1 dup1
/* "strict_asm_optimizer_steps/input.yul":75:87 */ /* "strict_asm_optimizer_steps/input.yul":75:87 */
revert revert
/* "strict_asm_optimizer_steps/input.yul":58:60 */ /* "strict_asm_optimizer_steps/input.yul":58:89 */
tag_1: tag_1:
/* "strict_asm_optimizer_steps/input.yul":138:162 */ /* "strict_asm_optimizer_steps/input.yul":138:162 */
dataSize(sub_0) dataSize(sub_0)

View File

@ -28,14 +28,14 @@ object "Contract" {
// tag_5: // tag_5:
// /* "source":78:79 */ // /* "source":78:79 */
// dup1 // dup1
// /* "source":75:77 */ // /* "source":75:89 */
// iszero // iszero
// tag_7 // tag_7
// jumpi // jumpi
// /* "source":82:87 */ // /* "source":82:87 */
// pop // pop
// jump(tag_6) // jump(tag_6)
// /* "source":75:77 */ // /* "source":75:89 */
// tag_7: // tag_7:
// /* "source":90:102 */ // /* "source":90:102 */
// tag_8 // tag_8
@ -64,4 +64,4 @@ object "Contract" {
// tag_9: // tag_9:
// Bytecode: 6026565b600b6001600e565b5b565b8015601857506024565b602260028201600e565b505b565b602e6001600e565b // Bytecode: 6026565b600b6001600e565b5b565b8015601857506024565b602260028201600e565b505b565b602e6001600e565b
// Opcodes: PUSH1 0x26 JUMP JUMPDEST PUSH1 0xB PUSH1 0x1 PUSH1 0xE JUMP JUMPDEST JUMPDEST JUMP JUMPDEST DUP1 ISZERO PUSH1 0x18 JUMPI POP PUSH1 0x24 JUMP JUMPDEST PUSH1 0x22 PUSH1 0x2 DUP3 ADD PUSH1 0xE JUMP JUMPDEST POP JUMPDEST JUMP JUMPDEST PUSH1 0x2E PUSH1 0x1 PUSH1 0xE JUMP JUMPDEST // Opcodes: PUSH1 0x26 JUMP JUMPDEST PUSH1 0xB PUSH1 0x1 PUSH1 0xE JUMP JUMPDEST JUMPDEST JUMP JUMPDEST DUP1 ISZERO PUSH1 0x18 JUMPI POP PUSH1 0x24 JUMP JUMPDEST PUSH1 0x22 PUSH1 0x2 DUP3 ADD PUSH1 0xE JUMP JUMPDEST POP JUMPDEST JUMP JUMPDEST PUSH1 0x2E PUSH1 0x1 PUSH1 0xE JUMP JUMPDEST
// SourceMappings: 33:21:0:-:0;;;48:4;50:1;48:4;:::i;:::-;33:21;:::o;59:45::-;78:1;75:2;;;82:5;;;75:2;90:12;99:1;96;92:9;90:12;:::i;:::-;59:45;;:::o;:::-;109:4;111:1;109:4;:::i;:::- // SourceMappings: 33:21:0:-:0;;;48:4;50:1;48:4;:::i;:::-;33:21;:::o;59:45::-;78:1;75:14;;;82:5;;;75:14;90:12;99:1;96;92:9;90:12;:::i;:::-;59:45;;:::o;:::-;109:4;111:1;109:4;:::i;:::-