public void CloneTest() { var exp = new Exp(new Number(0)); var clone = exp.Clone(); Assert.Equal(exp, clone); }
void Push(Exp exp, Env env, Cell destination = null) { stack.Push(new Frame { exp = exp.Clone(), env = env, destination = destination }); current = stack.Peek(); }
/// <summary> /// Analyzes the specified expression. /// </summary> /// <param name="exp">The expression.</param> /// <returns> /// The result of analysis. /// </returns> public override IExpression Analyze(Exp exp) { if (!Helpers.HasVariable(exp, Variable)) { return(new Number(0)); } return(new Mul(exp.Argument.Clone().Analyze(this), exp.Clone())); }
private void btnCopy_Click(object sender, EventArgs e) // 复制 { Exp copyFromExp = this.listBox1.SelectedItem as Exp; if (copyFromExp != null) { Exp newExp = copyFromExp.Clone() as Exp; this.listBox1.Items.Add(newExp); this.listBox1.SelectedItem = newExp; this.m_bChanged = true; } }
public object Clone() { ConditionData cd = new ConditionData(); if (datalist != null) { Exp exp = datalist[0] as Exp; List <Exp> elist = datalist[1] as List <Exp>; List <Exp> elist_new = new List <Exp>(); foreach (Exp ex in elist) { elist_new.Add(ex.Clone() as Exp); } cd.datalist = new object[] { exp.Clone(), elist_new }; } return(cd); }
void ReplaceCurrent(Exp exp, Env env = null) { current.ready = false; current.exp = exp.Clone(); current.env = env ?? current.env; }