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:
+3
-3
@@ -438,11 +438,11 @@ func CBE_EmitExpr(cbe: *CEmitter, node: *HirNode) {
|
||||
|
||||
// Break / Continue
|
||||
if kind == hBreak {
|
||||
StringBuilder_Append(&cbe.sb, "break");
|
||||
StringBuilder_Append(&cbe.sb, "break;");
|
||||
return;
|
||||
}
|
||||
if kind == hContinue {
|
||||
StringBuilder_Append(&cbe.sb, "continue");
|
||||
StringBuilder_Append(&cbe.sb, "continue;");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -609,7 +609,7 @@ func CBE_EmitExpr(cbe: *CEmitter, node: *HirNode) {
|
||||
}
|
||||
CBE_EmitExpr(cbe, child);
|
||||
// Add semicolon for statements that need it
|
||||
if child.kind != hBlock && child.kind != hIf && child.kind != hWhile && child.kind != hLoop {
|
||||
if child.kind != hBlock && child.kind != hIf && child.kind != hWhile && child.kind != hLoop && child.kind != hBreak && child.kind != hContinue {
|
||||
StringBuilder_Append(&cbe.sb, ";");
|
||||
}
|
||||
StringBuilder_Append(&cbe.sb, "\n");
|
||||
|
||||
Reference in New Issue
Block a user