Loop return no conditional
This commit is contained in:
parent
65ed3502c8
commit
6709fac566
2
TODOLIST
2
TODOLIST
@ -1,5 +1,3 @@
|
||||
returns inside loops (else conditional)
|
||||
returns inside loops (non-conditional)
|
||||
function pointers
|
||||
for loops
|
||||
arrays
|
||||
|
@ -3991,8 +3991,6 @@ pub fn analyze_local_block(thread: *Thread, analyzer: *Analyzer, parser: *Parser
|
||||
const loop_block = analyze_local_block(thread, analyzer, parser, file);
|
||||
if (!loop_block.terminated) {
|
||||
_ = emit_jump(analyzer, thread, loop_header_block);
|
||||
} else {
|
||||
unreachable;
|
||||
}
|
||||
},
|
||||
else => unreachable,
|
||||
|
7
retest/standalone/loop_return_no_conditional/main.nat
Normal file
7
retest/standalone/loop_return_no_conditional/main.nat
Normal file
@ -0,0 +1,7 @@
|
||||
fn[cc(.c)] main[export]() s32 {
|
||||
>i: s32 = 0;
|
||||
loop (i < 1) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user