Merge pull request #220 from birth-software/loop-return-nocondition
Loop return no conditional
This commit is contained in:
commit
c9d7dd6aa8
2
TODOLIST
2
TODOLIST
@ -1,5 +1,3 @@
|
|||||||
returns inside loops (else conditional)
|
|
||||||
returns inside loops (non-conditional)
|
|
||||||
function pointers
|
function pointers
|
||||||
for loops
|
for loops
|
||||||
arrays
|
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);
|
const loop_block = analyze_local_block(thread, analyzer, parser, file);
|
||||||
if (!loop_block.terminated) {
|
if (!loop_block.terminated) {
|
||||||
_ = emit_jump(analyzer, thread, loop_header_block);
|
_ = emit_jump(analyzer, thread, loop_header_block);
|
||||||
} else {
|
|
||||||
unreachable;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
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