MCPcopy Create free account
hub / github.com/aspizu/goboscript / branch

Method branch

src/codegen/stmt.rs:77–99  ·  view source on GitHub ↗
(
        &mut self,
        s: S,
        d: D,
        this_id: NodeID,
        cond: &Expr,
        if_body: &[Stmt],
        else_body: &[Stmt],
    )

Source from the content-addressed store, hash-verified

75 }
76
77 pub fn branch(
78 &mut self,
79 s: S,
80 d: D,
81 this_id: NodeID,
82 cond: &Expr,
83 if_body: &[Stmt],
84 else_body: &[Stmt],
85 ) -> io::Result<()> {
86 let cond = coerce_condition(cond);
87 let cond_id = self.id.new_id();
88 let if_body_id = self.id.new_id();
89 let else_body_id = self.id.new_id();
90 self.begin_inputs()?;
91 self.input(s, d, "CONDITION", &cond, cond_id)?;
92 self.substack("SUBSTACK", (!if_body.is_empty()).then_some(if_body_id))?;
93 self.substack("SUBSTACK2", (!else_body.is_empty()).then_some(else_body_id))?;
94 self.end_obj()?; // inputs
95 self.end_obj()?; // node
96 self.expr(s, d, &cond, cond_id, this_id)?;
97 self.stmts(s, d, if_body, if_body_id, Some(this_id))?;
98 self.stmts(s, d, else_body, else_body_id, Some(this_id))
99 }
100
101 pub fn until(
102 &mut self,

Callers 1

stmtMethod · 0.80

Calls 8

coerce_conditionFunction · 0.85
new_idMethod · 0.80
begin_inputsMethod · 0.80
substackMethod · 0.80
end_objMethod · 0.80
exprMethod · 0.80
stmtsMethod · 0.80
inputMethod · 0.45

Tested by

no test coverage detected