MCPcopy Create free account
hub / github.com/borgo-lang/borgo / emit_while_loop

Method emit_while_loop

compiler/src/codegen.rs:1398–1422  ·  view source on GitHub ↗
(&mut self, expr: &Expr, body: &Expr)

Source from the content-addressed store, hash-verified

1396 }
1397
1398 fn emit_while_loop(&mut self, expr: &Expr, body: &Expr) -> EmitResult {
1399 let mut out = emitter();
1400
1401 let expr = self.emit_local(expr, &mut out);
1402
1403 let stmts = wrap_block_and_get_statements(&body);
1404 let body = self
1405 .emit_block(
1406 EmitMode {
1407 ctx: Ctx::Discard,
1408 should_return: false,
1409 },
1410 &stmts,
1411 true,
1412 )
1413 .to_statement();
1414
1415 out.emit(format!(
1416 "for ({expr}) {{
1417 {body}
1418}}",
1419 ));
1420
1421 out.no_value()
1422 }
1423
1424 fn emit_loop_flow(&mut self, kind: &LoopFlow) -> EmitResult {
1425 let mut out = emitter();

Callers 1

emit_exprMethod · 0.80

Calls 7

emitterFunction · 0.85
emit_localMethod · 0.80
to_statementMethod · 0.80
emit_blockMethod · 0.80
emitMethod · 0.80
no_valueMethod · 0.80

Tested by

no test coverage detected