Exemplo n.º 1
0
// IfNode analyzes condition and run all children (ActionNodes).
func (exec Execute) IfNode(i *ast.IfNode) {
	if exec.ResolveComparisonNode(i.Conditions()) {
		for _, actionNode := range i.Stack() {
			exec.ActionNode(actionNode)
		}
	} else if i.ElseNode() != nil {
		exec.IfNode(i.ElseNode())
	}
}
Exemplo n.º 2
0
// IfNode skips any condition evaluation and draw all children (ActionNodes).
func (d Draw) IfNode(i *ast.IfNode) {
	d.nest++
	for _, actionNode := range i.Stack() {
		d.ActionNode(actionNode)
	}
	if i.ElseNode() != nil {
		d.IfNode(i.ElseNode())
	}
	d.nest--
}
Exemplo n.º 3
0
// IfNode analyzes condition and run all children (ActionNodes).
func (tc Typechecker) IfNode(i *ast.IfNode) {
	tc.execute.(ast.Comparator).ResolveComparisonNode(i.Conditions())

	for _, actionNode := range i.Stack() {
		tc.ActionNode(actionNode)
	}

	if i.ElseNode() != nil {
		tc.IfNode(i.ElseNode())
	}
}