상속: Statement, IGotoStatement
예제 #1
0
 private GotoStatement MakeGoto(IOperation currentOperation)
 {
     GotoStatement gotoStatement = new GotoStatement();
       gotoStatement.TargetStatement = this.GetTargetStatement(currentOperation.Value);
       List<IGotoStatement> values;
       var found = this.predecessors.TryGetValue(gotoStatement.TargetStatement, out values);
       if (!found) {
     var l = new List<IGotoStatement>();
     l.Add(gotoStatement);
     this.predecessors.Add(gotoStatement.TargetStatement, l);
       } else {
     values.Add(gotoStatement);
       }
       return gotoStatement;
 }
예제 #2
0
 private GotoStatement MakeGoto(IOperation currentOperation) {
   Contract.Requires(currentOperation != null);
   GotoStatement gotoStatement = new GotoStatement();
   Contract.Assume(currentOperation.Value is uint);
   gotoStatement.TargetStatement = this.GetTargetStatement((uint)currentOperation.Value);
   var key = (uint)gotoStatement.TargetStatement.Label.UniqueKey;
   List<IGotoStatement> gotos = this.gotosThatTarget[key];
   if (gotos == null) this.gotosThatTarget[key] = gotos = new List<IGotoStatement>();
   gotos.Add(gotoStatement);
   return gotoStatement;
 }
예제 #3
0
 private Statement ParseSwitchInstruction(IOperation operation)
 {
     SwitchInstruction result = new SwitchInstruction();
       result.switchExpression = this.PopOperandStack();
       uint[] branches = (uint[])operation.Value;
       foreach (uint targetAddress in branches) {
     BasicBlock bb = this.GetOrCreateBlock(targetAddress, true);
     var gotoBB = new GotoStatement() { TargetStatement = (LabeledStatement)bb.Statements[0] };
     result.switchCases.Add(gotoBB);
       }
       return result;
 }
예제 #4
0
파일: Copier.cs 프로젝트: riverar/devtools
 /// <summary>
 /// Visits the specified goto statement.
 /// </summary>
 /// <param name="gotoStatement">The goto statement.</param>
 /// <returns></returns>
 protected virtual IStatement DeepCopy(GotoStatement gotoStatement)
 {
     return gotoStatement;
 }
예제 #5
0
 private Statement ParseSwitchInstruction(IOperation currentOperation) {
   Contract.Requires(currentOperation != null);
   SwitchInstruction result = new SwitchInstruction();
   result.switchExpression = this.PopOperandStack();
   Contract.Assume(currentOperation.Value is uint[]);
   uint[] branches = (uint[])currentOperation.Value;
   foreach (uint targetAddress in branches) {
     var target = this.GetTargetStatement(targetAddress);
     var gotoBB = new GotoStatement() { TargetStatement = target };
     var key = (uint)gotoBB.TargetStatement.Label.UniqueKey;
     List<IGotoStatement> gotos = this.gotosThatTarget[key];
     if (gotos == null) this.gotosThatTarget[key] = gotos = new List<IGotoStatement>();
     gotos.Add(gotoBB);
     result.SwitchCases.Add(gotoBB);
   }
   return result;
 }
예제 #6
0
파일: Copier.cs 프로젝트: riverar/devtools
 /// <summary>
 /// Visits the specified goto statement.
 /// </summary>
 /// <param name="gotoStatement">The goto statement.</param>
 public override void Visit(IGotoStatement gotoStatement)
 {
     GotoStatement mutableGotoStatement = new GotoStatement(gotoStatement);
     this.resultStatement = this.myCodeCopier.DeepCopy(mutableGotoStatement);
 }
예제 #7
0
    private bool RemoveEndFinallyFrom(DecompiledBlock block, LabeledStatement labelToGoto) {
      Contract.Requires(block != null);
      Contract.Requires(labelToGoto != null);

      for (int i = 0; i < block.Statements.Count; i++) {
        if (block.Statements[i] is EndFinally) {
          var gotoFinally = new GotoStatement() { TargetStatement = labelToGoto };
          block.Statements[i] = gotoFinally;
          var gotos = new List<IGotoStatement>(1);
          gotos.Add(gotoFinally);
          this.gotosThatTarget[(uint)labelToGoto.Label.UniqueKey] = gotos;
          return true;
        }
        var nestedBlock = block.Statements[i] as DecompiledBlock;
        if (nestedBlock != null && this.RemoveEndFinallyFrom(nestedBlock, labelToGoto)) return true;
      }
      return false;
    }
예제 #8
0
파일: Mutator.cs 프로젝트: riverar/devtools
 /// <summary>
 /// Rewrites the children of the given goto statement.
 /// </summary>
 public virtual void RewriteChildren(GotoStatement gotoStatement)
 {
     this.RewriteChildren((Statement)gotoStatement);
 }
예제 #9
0
파일: Mutator.cs 프로젝트: riverar/devtools
 /// <summary>
 /// Visits the specified goto statement.
 /// </summary>
 /// <param name="gotoStatement">The goto statement.</param>
 /// <returns></returns>
 public virtual IStatement Visit(GotoStatement gotoStatement)
 {
     return gotoStatement;
 }
예제 #10
0
파일: Mutator.cs 프로젝트: riverar/devtools
 /// <summary>
 /// Visits the specified goto statement.
 /// </summary>
 /// <param name="gotoStatement">The goto statement.</param>
 public override void Visit(IGotoStatement gotoStatement)
 {
     GotoStatement mutableGotoStatement = gotoStatement as GotoStatement;
     if (alwaysMakeACopy || mutableGotoStatement == null) mutableGotoStatement = new GotoStatement(gotoStatement);
     this.resultStatement = this.myCodeMutator.Visit(mutableGotoStatement);
 }