diff --git a/src/build/expression/Expression.go b/src/build/expression/Expression.go index 8f99725..60b3794 100644 --- a/src/build/expression/Expression.go +++ b/src/build/expression/Expression.go @@ -28,6 +28,10 @@ func NewLeaf(t token.Token) *Expression { // AddChild adds a child to the expression. func (expr *Expression) AddChild(child *Expression) { + if expr.Children == nil { + expr.Children = make([]*Expression, 0, 2) + } + expr.Children = append(expr.Children, child) child.Parent = expr }