Skip to content

Commit

Permalink
InternalTrees: don't keep token cache per tree
Browse files Browse the repository at this point in the history
There's already a token cache per input, so this is excessive and
unnecessary. First introduced in #3484.
  • Loading branch information
kitbellew committed Mar 16, 2024
1 parent eeb1ea6 commit 685cb4e
Showing 1 changed file with 1 addition and 7 deletions.
Expand Up @@ -66,13 +66,7 @@ trait InternalTree extends Product {
}

def tokenizeFor(dialect: Dialect): Tokens =
if (origin.dialectOpt.contains(dialect)) tokensOpt.get else lookupOrTokenizeFor(dialect)

private val tokenCache: mutable.Map[Dialect, Tokens] =
Compat.newMutableMap[Dialect, Tokens]

private def lookupOrTokenizeFor(dialect: Dialect): Tokens =
tokenCache.getOrElseUpdate(dialect, tokenizeForDialect(dialect))
if (origin.dialectOpt.contains(dialect)) tokensOpt.get else tokenizeForDialect(dialect)

private lazy val tokensOpt: Option[Tokens] =
origin match {
Expand Down

0 comments on commit 685cb4e

Please sign in to comment.