diff --git a/lang/ast/ast.go b/lang/ast/ast.go index c47b5a11..a9898281 100644 --- a/lang/ast/ast.go +++ b/lang/ast/ast.go @@ -594,7 +594,7 @@ func (n *If) ElseIf() *If { return n.rhs.If() } func (n *If) BodyIfTrue() []*Node { return n.list2 } func (n *If) BodyIfFalse() []*Node { return n.list1 } -func NewIf(condition *Expr, elseIf *If, bodyIfTrue []*Node, bodyIfFalse []*Node) *If { +func NewIf(condition *Expr, bodyIfTrue []*Node, bodyIfFalse []*Node, elseIf *If) *If { return &If{ kind: KIf, mhs: condition.Node(), diff --git a/lang/parse/parse.go b/lang/parse/parse.go index d6f00d6c..6ed241c2 100644 --- a/lang/parse/parse.go +++ b/lang/parse/parse.go @@ -721,7 +721,7 @@ func (p *parser) parseIf() (*a.If, error) { } } } - return a.NewIf(condition, elseIf, bodyIfTrue, bodyIfFalse), nil + return a.NewIf(condition, bodyIfTrue, bodyIfFalse, elseIf), nil } func (p *parser) parseIterateNode() (*a.Node, error) {