Skip to content

Commit 3e60b78

Browse files
authored
Merge pull request #1508 from retronym/faster/regex-precompile
Precompile a regex in hot code
2 parents dfd4b58 + 9e0c663 commit 3e60b78

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

internal/compiler-bridge/src/main/scala/xsbt/ExtractAPI.scala

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import xsbti.api._
1919
import scala.annotation.tailrec
2020
import scala.tools.nsc.Global
2121
import scala.PartialFunction.cond
22+
import ExtractAPI.ConstructorWithDefaultArgument
2223

2324
/**
2425
* Extracts full (including private members) API representation out of Symbols and Types.
@@ -836,9 +837,8 @@ class ExtractAPI[GlobalType <: Global](
836837
constructorNameAsString(s.enclClass)
837838
else {
838839
val decoded = name.decode
839-
val constructorWithDefaultArgument = "<init>\\$default\\$(\\d+)".r
840840
decoded match {
841-
case constructorWithDefaultArgument(index) => constructorNameAsString(s.enclClass, index)
841+
case ConstructorWithDefaultArgument(index) => constructorNameAsString(s.enclClass, index)
842842
case _ => decoded
843843
}
844844
}
@@ -866,4 +866,5 @@ class ExtractAPI[GlobalType <: Global](
866866

867867
object ExtractAPI {
868868
private val emptyAnnotationArray = new Array[xsbti.api.Annotation](0)
869+
private val ConstructorWithDefaultArgument = "<init>\\$default\\$(\\d+)".r
869870
}

0 commit comments

Comments
 (0)