diff options
author | Mike Krüger <mkrueger@xamarin.com> | 2014-08-27 14:18:47 +0400 |
---|---|---|
committer | Mike Krüger <mkrueger@xamarin.com> | 2014-08-27 14:18:47 +0400 |
commit | 13da5ab4eccaae1589cac029d2b06adc75ae53ce (patch) | |
tree | 125729a5861825ff20059544a35b37b30e48faba /ICSharpCode.NRefactory | |
parent | db6f8a467f9d5ec4f5eefc6a2c6d38a2d4c17608 (diff) |
Fixed semantic highlighting issue.
Diffstat (limited to 'ICSharpCode.NRefactory')
-rw-r--r-- | ICSharpCode.NRefactory/TypeSystem/DomRegion.cs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/ICSharpCode.NRefactory/TypeSystem/DomRegion.cs b/ICSharpCode.NRefactory/TypeSystem/DomRegion.cs index 62c106c6..11b0f794 100644 --- a/ICSharpCode.NRefactory/TypeSystem/DomRegion.cs +++ b/ICSharpCode.NRefactory/TypeSystem/DomRegion.cs @@ -151,12 +151,31 @@ namespace ICSharpCode.NRefactory.TypeSystem (line != BeginLine || column >= BeginColumn) && (line != EndLine || column <= EndColumn); } - + public bool IsInside(TextLocation location) { return IsInside(location.Line, location.Column); } + /// <remarks> + /// Returns true, if the given coordinates (line, column) are in the region. + /// This method assumes that for an unknown end the end line is == -1 + /// </remarks> + public bool Contains(int line, int column) + { + if (IsEmpty) + return false; + return line >= BeginLine && + (line <= EndLine || EndLine == -1) && + (line != BeginLine || column >= BeginColumn) && + (line != EndLine || column < EndColumn); + } + + public bool Contains(TextLocation location) + { + return Contains(location.Line, location.Column); + } + public bool IntersectsWith (DomRegion region) { return region.Begin <= End && region.End >= Begin; |