Loop return if
This commit is contained in:
parent
663e4e8a1d
commit
110b1496ef
@ -3120,7 +3120,7 @@ fn worker_thread(thread_index: u32, cpu_count: *u32) void {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
.llvm_generate_ir => {
|
.llvm_generate_ir => {
|
||||||
if (thread.functions.length > 0) {
|
if (thread.functions.length > 0 or thread.global_variables.length > 0) {
|
||||||
const context = LLVM.Context.create();
|
const context = LLVM.Context.create();
|
||||||
const module_name: []const u8 = "thread";
|
const module_name: []const u8 = "thread";
|
||||||
const module = LLVM.Module.create(module_name.ptr, module_name.len, context);
|
const module = LLVM.Module.create(module_name.ptr, module_name.len, context);
|
||||||
|
21
retest/standalone/loop_return_if/main.nat
Normal file
21
retest/standalone/loop_return_if/main.nat
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
>m: s32 = 2;
|
||||||
|
>n: s32 = 6;
|
||||||
|
|
||||||
|
fn foo(arg: s32) s32 {
|
||||||
|
>i: s32 = 0;
|
||||||
|
loop (i < arg) {
|
||||||
|
if (i > 2) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn[cc(.c)] main[export]() s32 {
|
||||||
|
>a = foo(n);
|
||||||
|
>b = foo(n);
|
||||||
|
return (a - b) + (a - (m + 1)) + (b - (m + 1));
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user