Example #1
0
    internal StatementList/*!*/ ParseStatements() {
      this.ParseHeader();
      if (this.size == 0) return new StatementList(0);
      this.CreateBlocksForBranchTargets();
      StatementList result = new StatementList();
      Block currentBlock = null;
      while (this.counter < size){
        if (currentBlock == null){
          currentBlock = Reader.GetOrCreateBlock(this.blockMap, this.counter);
#if ILOFFSETS
          currentBlock.SourceContext = lastSourceContext;
#endif
          result.Add(currentBlock);
        }
        bool endOfBasicBlock = this.ParseStatement(currentBlock);
        if (endOfBasicBlock) currentBlock = null;
      }
      result.Add(Reader.GetOrCreateBlock(this.blockMap, this.counter));
      return result;
    }
Example #2
0
    internal StatementList/*!*/ ParseStatements() {
      this.ParseHeader();
      if (this.size == 0) return new StatementList(0);
      this.CreateBlocksForBranchTargets();
      StatementList result = new StatementList();
      Block currentBlock = null;
      while (this.counter < size){
        if (currentBlock == null){
          currentBlock = Reader.GetOrCreateBlock(this.blockMap, this.counter);
          result.Add(currentBlock);
        }
        bool endOfBasicBlock = this.ParseStatement(currentBlock);
#if ILOFFSETS
        if (currentBlock != null && currentBlock.SourceContext.Document == null) {
          // Since the current block does not have a source context, it inherits the
          // last source context that was encountered within this basic block.
          currentBlock.SourceContext = lastSourceContext;
        }
#endif
        if (endOfBasicBlock) {
#if ILOFFSETS
          // We only want source context inheritance within basic blocks.
          lastSourceContext = new SourceContext();
#endif
          currentBlock = null;
        }
      }
      result.Add(Reader.GetOrCreateBlock(this.blockMap, this.counter));
      return result;
    }