using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ShintenScript { public class ASTNodeNegative : IASTNode { public IASTNode node; public ASTNodeNegative(IASTNode of) { node = of; } public bool Const() { return node.Const(); } public object CreateFunction() { Func func = (Func)node.CreateFunction(); return (Func)(ctx => -func(ctx)); } public SSType Type() { if (node.Type() != SSType.real) throw new TypeException($"Unary '-' operator not supported for {node.Type()}"); return SSType.real; } } }