3 ms·
Sure, the AST node for "when" is here: https://github.com/vrok/have/blob/master/have/ast.go#L159 https://github.com/vrok/have/blob/master/have/ast.go#L159 Type
by wowoc 10y ago
Sure, the AST node for "when" is here: https://github.com/vrok/have/blob/master/have/ast.go#L159 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#L728 https://github.com/vrok/have/blob/master/have/generator.go#L...