Inheritance: ICatchClause
コード例 #1
0
ファイル: Copier.cs プロジェクト: riverar/devtools
 /// <summary>
 /// Visits the specified catch clause.
 /// </summary>
 /// <param name="catchClause">The catch clause.</param>
 /// <returns></returns>
 protected virtual ICatchClause DeepCopy(CatchClause catchClause)
 {
     if (catchClause.FilterCondition != null)
     catchClause.FilterCondition = Substitute(catchClause.FilterCondition);
       catchClause.Body = (IBlockStatement)Substitute(catchClause.Body);
       return catchClause;
 }
コード例 #2
0
 /// <summary>
 /// Rewrites the children of the given catch clause.
 /// </summary>
 /// <param name="catchClause"></param>
 public override void RewriteChildren(CatchClause catchClause) {
   if (this.scopesWithCapturedLocals.ContainsKey(catchClause)) {
     var statements = ((BlockStatement)catchClause.Body).Statements;
     this.AllocateClosureFor(catchClause, statements,
       delegate() {
         this.isInsideAnonymousMethod = true;
         var local = catchClause.ExceptionContainer;
         var fieldType = this.Rewrite(this.copier.Copy(local.Type)); //get the type as the anon delegate will see it
         this.isInsideAnonymousMethod = false;
         this.CreateClosureField(local, fieldType, local.Type, local.Name.Value);
         var field = this.fieldReferencesForUseInsideThisMethod[local];
         statements.Insert(0, new ExpressionStatement() {
           Expression = new Assignment() {
             Target = new TargetExpression() { Instance = this.currentClosureObject, Definition = field, Type = field.Type },
             Source = new BoundExpression() { Definition = local, Type = local.Type },
             Type = local.Type,
           }
         });
         base.RewriteChildren(catchClause);
       });
   } else
     base.RewriteChildren(catchClause);
 }
コード例 #3
0
ファイル: Copier.cs プロジェクト: riverar/devtools
 /// <summary>
 /// Create a mutable copy of an icatchclause.
 /// </summary>
 /// <param name="catchClause"></param>
 /// <returns></returns>
 protected virtual CatchClause GetMutableCopy(ICatchClause catchClause)
 {
     var copy = new CatchClause(catchClause);
       return copy;
 }
コード例 #4
0
 private static void DecompileHandler(BasicBlock containingBlock, BasicBlock handlerBlock, TryCatchFinallyStatement tryStatement)
 {
     if (handlerBlock.ExceptionInformation.HandlerKind == HandlerKind.Finally) {
     tryStatement.FinallyBody = handlerBlock;
       } else if (handlerBlock.ExceptionInformation.HandlerKind == HandlerKind.Fault) {
     tryStatement.FaultBody = handlerBlock;
       } else {
     CatchClause catchClause = new CatchClause();
     catchClause.Body = handlerBlock;
     catchClause.ExceptionType = handlerBlock.ExceptionInformation.ExceptionType;
     if (handlerBlock.ExceptionInformation.HandlerKind == HandlerKind.Catch) {
       catchClause.ExceptionContainer = ExtractExceptionContainer(handlerBlock);
     } else if (handlerBlock.ExceptionInformation.HandlerKind == HandlerKind.Filter) {
       catchClause.FilterCondition = ExtractFilterCondition(handlerBlock);
     }
     tryStatement.CatchClauses.Add(catchClause);
       }
       //Remove handler from statements in containing block
       containingBlock.Statements[containingBlock.Statements.Count-1] = GetBasicBlockStartingAt(handlerBlock, handlerBlock.ExceptionInformation.HandlerEndOffset);
       RemoveEndFinally(handlerBlock);
 }
コード例 #5
0
ファイル: Mutator.cs プロジェクト: riverar/devtools
 /// <summary>
 /// Rewrites the children of the given catch clause.
 /// </summary>
 public virtual void RewriteChildren(CatchClause catchClause)
 {
     catchClause.ExceptionType = this.Rewrite(catchClause.ExceptionType);
       if (catchClause.ExceptionContainer != Dummy.LocalVariable)
     catchClause.ExceptionContainer = this.Rewrite((LocalDefinition)catchClause.ExceptionContainer);
       if (catchClause.FilterCondition != null)
     catchClause.FilterCondition = this.Rewrite(catchClause.FilterCondition);
       catchClause.Body = this.Rewrite((BlockStatement)catchClause.Body);
 }
コード例 #6
0
ファイル: Mutator.cs プロジェクト: riverar/devtools
 /// <summary>
 /// Visits the specified catch clause.
 /// </summary>
 /// <param name="catchClause">The catch clause.</param>
 /// <returns></returns>
 public virtual ICatchClause Visit(ICatchClause catchClause)
 {
     CatchClause mutableCatchClause = catchClause as CatchClause;
       if (!this.copyOnlyIfNotAlreadyMutable || mutableCatchClause == null)
     mutableCatchClause = new CatchClause(catchClause);
       return Visit(mutableCatchClause);
 }
コード例 #7
0
ファイル: Mutator.cs プロジェクト: riverar/devtools
 /// <summary>
 /// Visits the specified catch clause.
 /// </summary>
 /// <param name="catchClause">The catch clause.</param>
 /// <returns></returns>
 public virtual ICatchClause Visit(CatchClause catchClause)
 {
     if (catchClause.FilterCondition != null)
     catchClause.FilterCondition = Visit(catchClause.FilterCondition);
       catchClause.Body = Visit(catchClause.Body);
       return catchClause;
 }