public IEnumerable<IPrimarySourceLocation> GetPrimarySourceLocationsFor(IDerivedSourceLocation derivedSourceLocation)
//^^ 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;
{
foreach (ISourceLocation sourceLocation in this.GetFragmentLocationsFor(derivedSourceLocation)) {
IPrimarySourceLocation/*?*/ primarySourceLocation = sourceLocation as IPrimarySourceLocation;
if (primarySourceLocation != null)
yield return primarySourceLocation;
else {
IDerivedSourceLocation/*?*/ dLoc = sourceLocation as IDerivedSourceLocation;
if (dLoc != null) {
foreach (IPrimarySourceLocation pLoc in dLoc.PrimarySourceLocations)
yield return pLoc;
}
}
}
}