private Expression ParseCastIfPossible(IOperation currentOperation) { CastIfPossible result = new CastIfPossible(); result.ValueToCast = this.PopOperandStack(); result.TargetType = (ITypeReference)currentOperation.Value; return result; }
/// <summary> /// Visits the specified cast if possible. /// </summary> /// <param name="castIfPossible">The cast if possible.</param> /// <returns></returns> protected virtual IExpression DeepCopy(CastIfPossible castIfPossible) { castIfPossible.TargetType = Substitute(castIfPossible.TargetType); castIfPossible.ValueToCast = Substitute(castIfPossible.ValueToCast); castIfPossible.Type = this.Substitute(castIfPossible.Type); return castIfPossible; }
/// <summary> /// Visits the specified cast if possible. /// </summary> /// <param name="castIfPossible">The cast if possible.</param> public override void Visit(ICastIfPossible castIfPossible) { CastIfPossible mutableCastIfPossible = new CastIfPossible(castIfPossible); this.resultExpression = this.myCodeCopier.DeepCopy(mutableCastIfPossible); }
/// <summary> /// Rewrites the children of the cast-if-possible expression. /// </summary> public virtual void RewriteChildren(CastIfPossible castIfPossible) { this.RewriteChildren((Expression)castIfPossible); castIfPossible.ValueToCast = this.Rewrite(castIfPossible.ValueToCast); castIfPossible.TargetType = this.Rewrite(castIfPossible.TargetType); }
/// <summary> /// Visits the specified cast if possible. /// </summary> /// <param name="castIfPossible">The cast if possible.</param> public override void Visit(ICastIfPossible castIfPossible) { CastIfPossible mutableCastIfPossible = castIfPossible as CastIfPossible; if (alwaysMakeACopy || mutableCastIfPossible == null) mutableCastIfPossible = new CastIfPossible(castIfPossible); this.resultExpression = this.myCodeMutator.Visit(mutableCastIfPossible); }
/// <summary> /// Visits the specified cast if possible. /// </summary> /// <param name="castIfPossible">The cast if possible.</param> /// <returns></returns> public virtual IExpression Visit(CastIfPossible castIfPossible) { castIfPossible.TargetType = Visit(castIfPossible.TargetType); castIfPossible.ValueToCast = Visit(castIfPossible.ValueToCast); castIfPossible.Type = this.Visit(castIfPossible.Type); return castIfPossible; }