public override Statement VisitExpressionStatement(ExpressionStatement statement) { if (statement == null) return null; return base.VisitExpressionStatement((ExpressionStatement)statement.Clone()); }
/// <summary> /// </summary> /// <param name="expr_stat">Cloned</param> /// <returns></returns> public override Statement VisitExpressionStatement(ExpressionStatement expr_stat) { // The AST may have shared nodes. if (this.orig2Copy.ContainsKey(expr_stat)) { return this.orig2Copy[expr_stat]; } Expression newexpr = this.VisitExpression(expr_stat.Expression); if (newexpr == null) { // turn into nop statement return new Statement(NodeType.Nop); } // check for special case where we now have a PopExpression as the expression. // this corresponds to a push(pop), which is a noop and we need to represent it that way. if (newexpr.NodeType == NodeType.Pop && !(newexpr is UnaryExpression)) { return new Statement(NodeType.Nop); } ExpressionStatement copy = (ExpressionStatement)expr_stat.Clone(); copy.Expression = newexpr; copy.SourceContext = this.current_source_context; this.orig2Copy.Add(expr_stat, copy); return copy; }