Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Precompile a regex in hot code #1508

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
Loading