Skip to content

Commit

Permalink
Merge pull request #1508 from retronym/faster/regex-precompile
Browse files Browse the repository at this point in the history
Precompile a regex in hot code
  • Loading branch information
eed3si9n authored Dec 3, 2024
2 parents dfd4b58 + 9e0c663 commit 3e60b78
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/compiler-bridge/src/main/scala/xsbt/ExtractAPI.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import xsbti.api._
import scala.annotation.tailrec
import scala.tools.nsc.Global
import scala.PartialFunction.cond
import ExtractAPI.ConstructorWithDefaultArgument

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

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

0 comments on commit 3e60b78

Please sign in to comment.