MCPcopy Index your code
hub / github.com/endbasic/endbasic / compile_guard

Function compile_guard

core/src/compiler/top.rs:497–508  ·  view source on GitHub ↗

Compiles one loop guard expression to a temporary boolean register.

(
        ctx: &mut Context,
        symtable: &mut LocalSymtable<'_>,
        guard: Expr,
    )

Source from the content-addressed store, hash-verified

495fn compile_do(ctx: &mut Context, symtable: &mut LocalSymtable<'_>, span: DoSpan) -> Result<()> {
496 /// Compiles one loop guard expression to a temporary boolean register.
497 fn compile_guard(
498 ctx: &mut Context,
499 symtable: &mut LocalSymtable<'_>,
500 guard: Expr,
501 ) -> Result<(Register, LineCol)> {
502 let guard_pos = guard.start_pos();
503 let mut frozen = symtable.frozen();
504 let mut scope = frozen.temp_scope();
505 let reg = scope.alloc().map_err(|e| Error::from_syms(e, guard_pos))?;
506 compile_expr_as_type(&mut ctx.codegen, &mut frozen, reg, guard, ExprType::Boolean)?;
507 Ok((reg, guard_pos))
508 }
509
510 ctx.do_exit_stack.push(vec![]);
511

Callers 1

compile_doFunction · 0.85

Calls 5

compile_expr_as_typeFunction · 0.85
start_posMethod · 0.80
frozenMethod · 0.80
temp_scopeMethod · 0.80
allocMethod · 0.80

Tested by

no test coverage detected