File tree 1 file changed +5
-7
lines changed
compiler/src/dotty/tools/dotc/parsing 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -653,22 +653,20 @@ object Parsers {
653
653
* to ensure an indent region is properly closed by outdentation */
654
654
var maximumIndent : Option [IndentWidth ] = None
655
655
656
- def testChar (idx : Int , p : Char => Boolean ): Boolean = {
656
+ def testChar (idx : Int , p : Char => Boolean ): Boolean =
657
657
val txt = source.content
658
- idx < txt.length && p(txt(idx))
659
- }
658
+ idx > - 1 && idx < txt.length && p(txt(idx))
660
659
661
- def testChar (idx : Int , c : Char ): Boolean = {
660
+ def testChar (idx : Int , c : Char ): Boolean =
662
661
val txt = source.content
663
- idx < txt.length && txt(idx) == c
664
- }
662
+ idx > - 1 && idx < txt.length && txt(idx) == c
665
663
666
664
def testChars (from : Int , str : String ): Boolean =
667
665
str.isEmpty ||
668
666
testChar(from, str.head) && testChars(from + 1 , str.tail)
669
667
670
668
def skipBlanks (idx : Int , step : Int = 1 ): Int =
671
- if ( testChar(idx, c => c == ' ' || c == '\t ' || c == Chars .CR )) skipBlanks(idx + step, step)
669
+ if testChar(idx, c => c == ' ' || c == '\t ' || c == Chars .CR ) then skipBlanks(idx + step, step)
672
670
else idx
673
671
674
672
/** Parse indentation region `body` and rewrite it to be in braces instead */
You can’t perform that action at this time.
0 commit comments