/// <summary> /// Obtains a source location instance that corresponds to the substring of the document specified by the given start position and length. /// </summary> public IDerivedSourceLocation GetDerivedSourceLocation(int position, int length) //^^ requires 0 <= position && (position < this.Length || position == 0); //^^ requires 0 <= length; //^^ requires length <= this.Length; //^^ requires position+length <= this.Length; //^^ ensures result.SourceDocument == this; //^^ ensures result.StartIndex == position; //^^ ensures result.Length == length; { IDerivedSourceLocation result = new DerivedSourceLocation(this, position, length); //^ assume result.SourceDocument == this; //^ assume result.StartIndex == position; //^ assume result.Length == length; return result; }
//^^ requires 0 <= position && (position < this.Length || position == 0); //^^ requires 0 <= length; //^^ requires length <= this.Length; //^^ requires position+length <= this.Length; //^^ ensures result.SourceDocument == this; //^^ ensures result.StartIndex == position; //^^ ensures result.Length == length; /// <summary> /// Obtains a source location instance that corresponds to the substring of the document specified by the given start position and length. /// </summary> public IDerivedSourceLocation GetDerivedSourceLocation(int position, int length) { IDerivedSourceLocation result = new DerivedSourceLocation(this, position, length); //^ assume result.SourceDocument == this; //^ assume result.StartIndex == position; //^ assume result.Length == length; return result; }