Fix compilation of array initializer used inside field initializer of an anonymous...
[mono.git] / mcs / mcs / support.cs
index 081ea60c3edf4a1b05fe59c6e988c5f6a9a3a400..55841d0cc254f1b8b0ac3af080d724666045966c 100644 (file)
@@ -239,8 +239,8 @@ namespace Mono.CSharp {
                public char[] ReadChars (int fromPosition, int toPosition)
                {
                        char[] chars = new char[toPosition - fromPosition];
-                       if (buffer_start <= fromPosition && toPosition < buffer_start + buffer.Length) {
-                               Array.Copy (buffer, fromPosition, chars, 0, chars.Length);
+                       if (buffer_start <= fromPosition && toPosition <= buffer_start + buffer.Length) {
+                               Array.Copy (buffer, fromPosition - buffer_start, chars, 0, chars.Length);
                        } else {
                                throw new NotImplementedException ();
                        }