selfhost: for-in support for Channel<T>; fix break/continue C codegen
- lib/Channel.bux: add Channel_Recv_Ok<T> for use in for-in desugaring - hir_lower.bux: Channel for-in desugars to while+recv_ok pattern - c_backend.bux: emit 'break;' / 'continue;' with semicolon, fix missing semicolon when break/continue inside if-block - bootstrap/hir_lower.nim: skip generic methods in vtable generation to avoid referencing non-existent monomorphized C functions
This commit is contained in:
@@ -24,6 +24,10 @@ func Channel_Recv<T>(ch: *Channel<T>) -> T {
|
||||
return result;
|
||||
}
|
||||
|
||||
func Channel_Recv_Ok<T>(ch: *Channel<T>, out: *T) -> bool {
|
||||
return bux_channel_recv(ch.handle, out as *void) != 0;
|
||||
}
|
||||
|
||||
func Channel_Close<T>(ch: *Channel<T>) {
|
||||
bux_channel_close(ch.handle);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user