Skip to content

Commit 9719c6a

Browse files
committed
Synchronise quoted.Toolbox
1 parent f2efe05 commit 9719c6a

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

compiler/src/dotty/tools/dotc/quoted/Toolbox.scala

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,18 @@ object Toolbox {
1313

1414
private[this] val driver: QuoteDriver = new QuoteDriver()
1515

16-
def run[T](expr: Expr[T]): T = expr match {
17-
case expr: LiftedExpr[T] =>
18-
expr.value
19-
case expr: TastyTreeExpr[Tree] @unchecked =>
20-
throw new Exception("Cannot call `Expr.run` on an `Expr` that comes from an inline macro argument.")
21-
case _ =>
22-
driver.run(expr, settings)
16+
def run[T](expr: Expr[T]): T = synchronized {
17+
expr match {
18+
case expr: LiftedExpr[T] =>
19+
expr.value
20+
case expr: TastyTreeExpr[Tree] @unchecked =>
21+
throw new Exception("Cannot call `Expr.run` on an `Expr` that comes from an inline macro argument.")
22+
case _ =>
23+
driver.run(expr, settings)
24+
}
2325
}
2426

25-
def show[T](expr: Expr[T]): String = driver.show(expr, settings)
27+
def show[T](expr: Expr[T]): String = synchronized(driver.show(expr, settings))
2628

2729
}
2830
}

0 commit comments

Comments
 (0)