Skip to content

Commit da6246e

Browse files
committed
optimization
1 parent 3e745cf commit da6246e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

commons-macros/src/main/scala/com/avsystem/commons/macros/MacroCommons.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,18 @@ trait MacroCommons { bundle =>
9999
def indent(str: String, indent: String): String =
100100
str.replaceAllLiterally("\n", s"\n$indent")
101101

102-
def treeAsSeenFrom(tree: Tree, seenFrom: Type): Tree =
103-
if (seenFrom == NoType) tree else {
102+
def treeAsSeenFrom(tree: Tree, seenFrom: Type): Tree = seenFrom match {
103+
case NoType => tree
104+
case TypeRef(_, sym, Nil) if sym.isStatic => tree
105+
case _ =>
104106
val res = tree.duplicate
105107
res.foreach { t =>
106108
if (t.tpe != null) {
107109
internal.setType(t, t.tpe.asSeenFrom(seenFrom, seenFrom.typeSymbol))
108110
}
109111
}
110112
res
111-
}
113+
}
112114

113115
class Annot(annotTree: Tree, val subject: Symbol, val directSource: Symbol, val aggregate: Option[Annot]) {
114116
def aggregationChain: List[Annot] =

0 commit comments

Comments
 (0)