File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
compiler/src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -128,9 +128,11 @@ object Scanners {
128128
129129 // Setting token data ----------------------------------------------------
130130
131+ protected def initialCharBufferSize = 1024
132+
131133 /** A character buffer for literals
132134 */
133- protected val litBuf = CharBuffer ()
135+ protected val litBuf = CharBuffer (initialCharBufferSize )
134136
135137 /** append Unicode character to "litBuf" buffer
136138 */
@@ -244,7 +246,7 @@ object Scanners {
244246 def getDocComment (pos : Int ): Option [Comment ] = docstringMap.get(pos)
245247
246248 /** A buffer for comments */
247- private val commentBuf = CharBuffer ()
249+ private val commentBuf = CharBuffer (initialCharBufferSize )
248250
249251 def toToken (identifier : SimpleName ): Token =
250252 def handleMigration (keyword : Token ): Token =
@@ -1079,6 +1081,7 @@ object Scanners {
10791081 next
10801082
10811083 class LookaheadScanner (val allowIndent : Boolean = false ) extends Scanner (source, offset, allowIndent = allowIndent) {
1084+ override protected def initialCharBufferSize = 8
10821085 override def languageImportContext = Scanner .this .languageImportContext
10831086 }
10841087
You can’t perform that action at this time.
0 commit comments