Skip to content

Commit f9f32c9

Browse files
christianparpartchriseth
authored andcommitted
Fix source location for if statements.
1 parent 46514ff commit f9f32c9

File tree

9 files changed

+18
-16
lines changed

9 files changed

+18
-16
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Bugfixes:
1818
* Type Checker: Fix internal error and prevent static calls to unimplemented modifiers.
1919
* Yul Code Generator: Fix internal compiler error when using a long literal with bitwise negation.
2020
* Yul Code Generator: Fix source location references for calls to builtin functions.
21+
* Yul Parser: Fix source location references for ``if`` statements.
2122

2223

2324
### 0.8.6 (2021-06-22)

libyul/AsmParser.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ Statement Parser::parseStatement()
107107
advance();
108108
_if.condition = make_unique<Expression>(parseExpression());
109109
_if.body = parseBlock();
110+
_if.debugData = updateLocationEndFrom(_if.debugData, _if.body.debugData->location);
110111
return Statement{move(_if)};
111112
}
112113
case Token::Switch:

test/cmdlineTests/combined_json_generated_sources/output

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
"src": "127:35:1"
104104
},
105105
"nodeType": "YulIf",
106-
"src": "124:2:1"
106+
"src": "124:122:1"
107107
},
108108
{
109109
"nodeType": "YulAssignment",
@@ -188,7 +188,7 @@
188188
"src": "297:30:1"
189189
},
190190
"nodeType": "YulIf",
191-
"src": "294:2:1"
191+
"src": "294:117:1"
192192
},
193193
{
194194
"nodeType": "YulAssignment",
@@ -316,7 +316,7 @@
316316
"src": "461:41:1"
317317
},
318318
"nodeType": "YulIf",
319-
"src": "458:2:1"
319+
"src": "458:128:1"
320320
}
321321
]
322322
},
@@ -431,7 +431,7 @@
431431
"src": "712:32:1"
432432
},
433433
"nodeType": "YulIf",
434-
"src": "709:2:1"
434+
"src": "709:119:1"
435435
},
436436
{
437437
"nodeType": "YulBlock",
@@ -542,7 +542,7 @@
542542
"src": "914:30:1"
543543
},
544544
"nodeType": "YulIf",
545-
"src": "911:2:1"
545+
"src": "911:117:1"
546546
},
547547
{
548548
"nodeType": "YulAssignment",

test/cmdlineTests/optimizer_inliner_dynamic_reference/output

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ sub_0: assembly {
162162
dup3
163163
/* "#utility.yul":257:270 */
164164
gt
165-
/* "#utility.yul":254:256 */
165+
/* "#utility.yul":254:390 */
166166
iszero
167167
tag_30
168168
jumpi
@@ -188,7 +188,7 @@ sub_0: assembly {
188188
0x00
189189
/* "#utility.yul":365:380 */
190190
revert
191-
/* "#utility.yul":254:256 */
191+
/* "#utility.yul":254:390 */
192192
tag_30:
193193
pop
194194
/* "#utility.yul":406:415 */

test/cmdlineTests/optimizer_inliner_dynamic_reference_constructor/output

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ sub_0: assembly {
167167
dup3
168168
/* "#utility.yul":257:270 */
169169
gt
170-
/* "#utility.yul":254:256 */
170+
/* "#utility.yul":254:390 */
171171
iszero
172172
tag_26
173173
jumpi
@@ -193,7 +193,7 @@ sub_0: assembly {
193193
0x00
194194
/* "#utility.yul":365:380 */
195195
revert
196-
/* "#utility.yul":254:256 */
196+
/* "#utility.yul":254:390 */
197197
tag_26:
198198
pop
199199
/* "#utility.yul":406:415 */

test/cmdlineTests/standard_generatedSources/output.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

test/cmdlineTests/standard_optimizer_generatedSources/output.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

test/cmdlineTests/strict_asm_optimizer_steps/output

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Text representation:
3636
mstore
3737
/* "strict_asm_optimizer_steps/input.yul":61:72 */
3838
callvalue
39-
/* "strict_asm_optimizer_steps/input.yul":58:60 */
39+
/* "strict_asm_optimizer_steps/input.yul":58:89 */
4040
iszero
4141
tag_1
4242
jumpi
@@ -46,7 +46,7 @@ Text representation:
4646
dup1
4747
/* "strict_asm_optimizer_steps/input.yul":75:87 */
4848
revert
49-
/* "strict_asm_optimizer_steps/input.yul":58:60 */
49+
/* "strict_asm_optimizer_steps/input.yul":58:89 */
5050
tag_1:
5151
/* "strict_asm_optimizer_steps/input.yul":138:162 */
5252
dataSize(sub_0)

test/libyul/objectCompiler/jump_tags.yul

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ object "Contract" {
2828
// tag_5:
2929
// /* "source":78:79 */
3030
// dup1
31-
// /* "source":75:77 */
31+
// /* "source":75:89 */
3232
// iszero
3333
// tag_7
3434
// jumpi
3535
// /* "source":82:87 */
3636
// pop
3737
// jump(tag_6)
38-
// /* "source":75:77 */
38+
// /* "source":75:89 */
3939
// tag_7:
4040
// /* "source":90:102 */
4141
// tag_8
@@ -64,4 +64,4 @@ object "Contract" {
6464
// tag_9:
6565
// Bytecode: 6026565b600b6001600e565b5b565b8015601857506024565b602260028201600e565b505b565b602e6001600e565b
6666
// 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
67-
// 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;:::-
67+
// 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;:::-

0 commit comments

Comments
 (0)