package org.nwapw.abacus.tree /** * A unary operator node that reduces its children. * * NumberUnaryNode operates by simply reducing its child, * and using the result of that reduction to reduce itself. * @param operation the operation this node performs. * @param child the child this node should be applied to. */ class NumberUnaryNode(operation: String, child: TreeNode?) : UnaryNode(operation, child) { override fun reduce(reducer: Reducer): T? { val child = applyTo?.reduce(reducer) ?: return null return reducer.reduceNode(this, child) } }