Microsoft.Cci.SourceLocationBuilder.UpdateToSpan C# (CSharp) Method

UpdateToSpan() private method

private UpdateToSpan ( ISourceLocation sourceLocation ) : void
sourceLocation ISourceLocation
return void
    public void UpdateToSpan(ISourceLocation sourceLocation) {
      Contract.Requires(sourceLocation != null);

      int slStartIndex = sourceLocation.StartIndex;
      int slLength = sourceLocation.Length;
      int myStartIndex = this.startIndex;
      int myLength = this.length;
      int newStartIndex;
      int newLength;
      if (slStartIndex < myStartIndex) {
        newLength = myLength + (myStartIndex - slStartIndex);
        newStartIndex = slStartIndex;
      } else if (slStartIndex == myStartIndex) {
        newLength = slLength > myLength ? slLength : myLength;
        newStartIndex = myStartIndex;
      } else {
        newLength = (slStartIndex + slLength) - myStartIndex;
        newStartIndex = myStartIndex;
      }
      this.length = newLength;
      this.startIndex = newStartIndex;
    }

Usage Example

示例#1
0
 private BlockStatement ParseStatementBlock(TokenSet followers) {
   SourceLocationBuilder slb = new SourceLocationBuilder(this.scanner.CurrentSourceLocation);
   List<Statement> statements = new List<Statement>();
   this.ParseStatements(statements, followers);
   slb.UpdateToSpan(this.scanner.CurrentSourceLocation);
   return new BlockStatement(statements, slb);
 }
All Usage Examples Of Microsoft.Cci.SourceLocationBuilder::UpdateToSpan