Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

SI-7013 Scaladoc: Fix StackOverflowError

No one see the result value of parse and if so, it's tail-recursive.
  • Loading branch information...
commit df292901c3dd9688d1dabf4ebaa9d73a23ebfe80 1 parent 144671e
@kzys kzys authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/compiler/scala/tools/nsc/doc/html/SyntaxHigh.scala
View
6 src/compiler/scala/tools/nsc/doc/html/SyntaxHigh.scala
@@ -6,6 +6,7 @@
package scala.tools.nsc.doc.html
import scala.xml.NodeSeq
+import scala.annotation.tailrec
/** Highlight the syntax of Scala code appearing in a `{{{` wiki block
* (see method `HtmlPage.blockToHtml`).
@@ -209,9 +210,9 @@ private[html] object SyntaxHigh {
out.toString
}
- def parse(pre: String, i: Int): Int = {
+ @tailrec def parse(pre: String, i: Int): Unit = {
out append pre
- if (i == buf.length) return i
+ if (i == buf.length) return
buf(i) match {
case '\n' =>
parse("\n", i+1)
@@ -277,7 +278,6 @@ private[html] object SyntaxHigh {
} else
parse(buf(i).toChar.toString, i+1)
}
- i
}
parse("", 0)
Please sign in to comment.
Something went wrong with that request. Please try again.