Skip to content

Commit c79ecac

Browse files
committed
Merge pull request #44 from phaller/topic/cleanup-43
Clean-ups found during review of PR #43
2 parents 8993b6b + 064392e commit c79ecac

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/main/scala/scala/async/internal/Lifter.scala

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package scala.async.internal
22

33
trait Lifter {
44
self: AsyncMacro =>
5+
import scala.reflect.internal.Flags._
56
import global._
67

78
/**
@@ -106,26 +107,21 @@ trait Lifter {
106107

107108
val lifted = liftableSyms.map(symToTree).toList.map {
108109
t =>
110+
val sym = t.symbol
109111
val treeLifted = t match {
110112
case vd@ValDef(_, _, tpt, rhs) =>
111-
import reflect.internal.Flags._
112-
val sym = vd.symbol
113113
sym.setFlag(MUTABLE | STABLE | PRIVATE | LOCAL)
114114
sym.name = name.fresh(sym.name.toTermName)
115115
sym.modifyInfo(_.deconst)
116116
val zeroRhs = atPos(t.pos)(gen.mkZero(vd.symbol.info))
117117
treeCopy.ValDef(vd, Modifiers(sym.flags), sym.name, TypeTree(sym.tpe).setPos(t.pos), zeroRhs)
118118
case dd@DefDef(_, _, tparams, vparamss, tpt, rhs) =>
119-
import reflect.internal.Flags._
120-
val sym = dd.symbol
121119
sym.name = this.name.fresh(sym.name.toTermName)
122120
sym.setFlag(PRIVATE | LOCAL)
123121
// Was `DefDef(sym, rhs)`, but this ran afoul of `ToughTypeSpec.nestedMethodWithInconsistencyTreeAndInfoParamSymbols`
124122
// due to the handling of type parameter skolems in `thisMethodType` in `Namers`
125123
treeCopy.DefDef(dd, Modifiers(sym.flags), sym.name, tparams, vparamss, tpt, rhs)
126124
case cd@ClassDef(_, _, tparams, impl) =>
127-
import reflect.internal.Flags._
128-
val sym = cd.symbol
129125
sym.name = newTypeName(name.fresh(sym.name.toString).toString)
130126
companionship.companionOf(cd.symbol) match {
131127
case NoSymbol =>
@@ -135,8 +131,6 @@ trait Lifter {
135131
}
136132
treeCopy.ClassDef(cd, Modifiers(sym.flags), sym.name, tparams, impl)
137133
case md@ModuleDef(_, _, impl) =>
138-
import reflect.internal.Flags._
139-
val sym = md.symbol
140134
companionship.companionOf(md.symbol) match {
141135
case NoSymbol =>
142136
sym.name = name.fresh(sym.name.toTermName)
@@ -145,8 +139,6 @@ trait Lifter {
145139
}
146140
treeCopy.ModuleDef(md, Modifiers(sym.flags), sym.name, impl)
147141
case td@TypeDef(_, _, tparams, rhs) =>
148-
import reflect.internal.Flags._
149-
val sym = td.symbol
150142
sym.name = newTypeName(name.fresh(sym.name.toString).toString)
151143
treeCopy.TypeDef(td, Modifiers(sym.flags), sym.name, tparams, rhs)
152144
}

0 commit comments

Comments
 (0)