Hacker News new | ask | show | jobs
by wowoc 3562 days ago
Sure, the AST node for "when" is here: https://github.com/vrok/have/blob/master/have/ast.go#L159

Type checker checks the condition before every branch in "when" statements, and sets the "True" flag if it evaluated to true.

Then the code generator just skips over branches that don't have the "True" flag set: https://github.com/vrok/have/blob/master/have/generator.go#L...