Skip to content

Commit 52db988

Browse files
committed
Make isVolatile a SymUtil method.
1 parent 47f0b45 commit 52db988

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/dotty/tools/dotc/transform/LazyVals.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import dotty.tools.dotc.core.Constants.Constant
1515
import dotty.tools.dotc.core.Types.MethodType
1616
import dotty.tools.dotc.core.Names.Name
1717
import dotty.runtime.LazyVals
18+
import SymUtils._
1819
import scala.collection.mutable.ListBuffer
1920
import dotty.tools.dotc.core.Denotations.SingleDenotation
2021
import dotty.tools.dotc.core.SymDenotations.SymDenotation
@@ -78,10 +79,9 @@ class LazyValTranformContext {
7879
if (!(tree.mods is Flags.Lazy)) tree
7980
else {
8081
val isField = tree.symbol.owner.isClass
81-
val isVolatile = tree.symbol.hasAnnotation(defn.VolatileAnnot)
8282

8383
if (isField) {
84-
if (isVolatile) transformFieldValDefVolatile(tree)
84+
if (tree.symbol.isVolatile) transformFieldValDefVolatile(tree)
8585
else transformFieldValDefNonVolatile(tree)
8686
}
8787
else transformLocalValDef(tree)

src/dotty/tools/dotc/transform/SymUtils.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@ class SymUtils(val self: Symbol) extends AnyVal {
2020

2121
def isTypeTestOrCast(implicit ctx: Context): Boolean =
2222
self == defn.Any_asInstanceOf || self == defn.Any_isInstanceOf
23+
24+
def isVolatile(implicit ctx: Context) = self.hasAnnotation(defn.VolatileAnnot)
2325
}

0 commit comments

Comments
 (0)