using HeuristicLab.Algorithms.PushGP.Stack; namespace HeuristicLab.Algorithms.PushGP.Expressions { public class NameDefineXExecExpression : Expression { public NameDefineXExecExpression(string value) : base(OpCode.NameDefineXExec) { this.Value = value; } public string Value { get; } public override void Eval(IInterpreterService interpreterService) { Expression expression; if (interpreterService.CustomExpressions.TryGetValue(this.Value, out expression)) { interpreterService.ExecStack.Push(expression); } else { interpreterService.NameStack.Push(this.Value); } } public override string ToString() { return this.Value; } } }