示例#1
0
 private Expression ParseCastIfPossible(IOperation currentOperation)
 {
     CastIfPossible result = new CastIfPossible();
       result.ValueToCast = this.PopOperandStack();
       result.TargetType = (ITypeReference)currentOperation.Value;
       return result;
 }
示例#2
0
 /// <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;
 }
示例#3
0
 /// <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);
 }
示例#4
0
 /// <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);
 }
示例#5
0
 /// <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);
 }
示例#6
0
 /// <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;
 }