diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-04-09 18:14:25 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-04-09 23:13:51 +0200 |
commit | 74957b3b20aae3a0a2c7a41000c5a1424586f412 (patch) | |
tree | eb26dcb0cf2cf992ebf8d2eb763d03ff6da8634d /src/dotty/tools/backend | |
parent | d0804782ba6956b1f906e646d14e3547adcaa23a (diff) | |
download | dotty-74957b3b20aae3a0a2c7a41000c5a1424586f412.tar.gz dotty-74957b3b20aae3a0a2c7a41000c5a1424586f412.tar.bz2 dotty-74957b3b20aae3a0a2c7a41000c5a1424586f412.zip |
Ensure spaces after `if` in Dotty source.
Diffstat (limited to 'src/dotty/tools/backend')
-rw-r--r-- | src/dotty/tools/backend/jvm/CollectEntryPoints.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/backend/jvm/DottyBackendInterface.scala | 14 | ||||
-rw-r--r-- | src/dotty/tools/backend/jvm/LabelDefs.scala | 12 |
3 files changed, 14 insertions, 14 deletions
diff --git a/src/dotty/tools/backend/jvm/CollectEntryPoints.scala b/src/dotty/tools/backend/jvm/CollectEntryPoints.scala index 734890daa..513144bd6 100644 --- a/src/dotty/tools/backend/jvm/CollectEntryPoints.scala +++ b/src/dotty/tools/backend/jvm/CollectEntryPoints.scala @@ -40,7 +40,7 @@ class CollectEntryPoints extends MiniPhaseTransform { def phaseName: String = "Collect entry points" override def transformDefDef(tree: tpd.DefDef)(implicit ctx: Context, info: TransformerInfo): tpd.Tree = { - if((tree.symbol ne NoSymbol) && CollectEntryPoints.isJavaEntyPoint(tree.symbol)) { + if ((tree.symbol ne NoSymbol) && CollectEntryPoints.isJavaEntyPoint(tree.symbol)) { ctx.genBCodePhase.asInstanceOf[GenBCode].registerEntryPoint(tree.symbol) } tree diff --git a/src/dotty/tools/backend/jvm/DottyBackendInterface.scala b/src/dotty/tools/backend/jvm/DottyBackendInterface.scala index ee8d27137..e9c8dbc80 100644 --- a/src/dotty/tools/backend/jvm/DottyBackendInterface.scala +++ b/src/dotty/tools/backend/jvm/DottyBackendInterface.scala @@ -376,7 +376,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ def shouldEmitJumpAfterLabels = true def dumpClasses: Option[String] = - if(ctx.settings.Ydumpclasses.isDefault) None + if (ctx.settings.Ydumpclasses.isDefault) None else Some(ctx.settings.Ydumpclasses.value) def mainClass: Option[String] = @@ -423,7 +423,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ case TermRef(prefix: ThisType, name) => Some(tpd.This(prefix.cls).select(i.symbol)) case TermRef(NoPrefix, name) => - if(i.symbol is Flags.Method) Some(This(i.symbol.enclosingClass).select(i.symbol)) // workaround #342 todo: remove after fixed + if (i.symbol is Flags.Method) Some(This(i.symbol.enclosingClass).select(i.symbol)) // workaround #342 todo: remove after fixed else None case _ => None } @@ -663,7 +663,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ def companionSymbol: Symbol = if (sym is Flags.Module) companionClass else companionModule def moduleClass: Symbol = toDenot(sym).moduleClass def enclosingClassSym: Symbol = { - if(this.isClass) { + if (this.isClass) { val ct = ctx.withPhase(ctx.flattenPhase.prev) toDenot(sym)(ct).owner.enclosingClass(ct) } @@ -792,7 +792,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ t.info match { case _ => - if(!t.symbol.isClass) nonClassTypeRefToBType(t.symbol) // See comment on nonClassTypeRefToBType + if (!t.symbol.isClass) nonClassTypeRefToBType(t.symbol) // See comment on nonClassTypeRefToBType else primitiveOrClassToBType(t.symbol) // Common reference to a type such as scala.Int or java.lang.String } case Types.ClassInfo(_, sym, _, _, _) => primitiveOrClassToBType(sym) // We get here, for example, for genLoadModule, which invokes toTypeKind(moduleClassSymbol.info) @@ -942,7 +942,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ def _3: Tree = field.rhs override def unapply(s: LabelDef): DottyBackendInterface.this.LabelDef.type = { - if(s.symbol is Flags.Label) this.field = s + if (s.symbol is Flags.Label) this.field = s else this.field = null this } @@ -1021,11 +1021,11 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ def _2 = field.meth def _3 = { val t = field.tpt.tpe.typeSymbol - if(t.exists) t + if (t.exists) t else { val arity = field.meth.tpe.widenDealias.paramTypes.size - _1.size val returnsUnit = field.meth.tpe.widenDealias.resultType.classSymbol == UnitClass - if(returnsUnit) + if (returnsUnit) ctx.requiredClass(("scala.compat.java8.JProcedure" + arity).toTermName) else ctx.requiredClass(("scala.compat.java8.JFunction" + arity).toTermName) } diff --git a/src/dotty/tools/backend/jvm/LabelDefs.scala b/src/dotty/tools/backend/jvm/LabelDefs.scala index 769dcdc36..8f9e3bdcc 100644 --- a/src/dotty/tools/backend/jvm/LabelDefs.scala +++ b/src/dotty/tools/backend/jvm/LabelDefs.scala @@ -44,7 +44,7 @@ import StdNames.nme * * <label> def foo(i: Int) = { * <label> def bar = 0 - * <label> def dough(i: Int) = if(i == 0) bar else foo(i-1) + * <label> def dough(i: Int) = if (i == 0) bar else foo(i-1) * dough(i) * } * @@ -54,7 +54,7 @@ import StdNames.nme * * \ * <label> def foo(i: Int) = dough(i) - * <label> def dough(i: Int) = if(i == 0) bar else foo(i-1) + * <label> def dough(i: Int) = if (i == 0) bar else foo(i-1) * <label> def bar = 2 * foo(100) * @@ -64,7 +64,7 @@ import StdNames.nme * <jump foo> * <label> def foo(i: Int) = dough(i) * // <jump a> // unreachable - * <label> def dough(i: Int) = if(i == 0) bar else foo(i-1) + * <label> def dough(i: Int) = if (i == 0) bar else foo(i-1) * // <jump a> // unreachable * <label> def bar = 2 * // <jump a> // unreachable @@ -107,7 +107,7 @@ class LabelDefs extends MiniPhaseTransform { labelLevel = labelLevel + 1 val r = Block(moveLabels(t), t) labelLevel = labelLevel - 1 - if(labelLevel == 0) beingAppended.clear() + if (labelLevel == 0) beingAppended.clear() r case _ => if (entryPoints.nonEmpty && labelDefs.nonEmpty) super.transform(tree) else tree } @@ -206,14 +206,14 @@ class LabelDefs extends MiniPhaseTransform { labelCalls(r.symbol) = parentLabelCalls parentLabelCalls = st - if(shouldMoveLabel) { + if (shouldMoveLabel) { labelDefs(r.symbol) = r EmptyTree } else r case t: Apply if t.symbol is Flags.Label => val sym = t.symbol parentLabelCalls = parentLabelCalls + t - if(owner != sym) callCounts(sym) = callCounts(sym) + 1 + if (owner != sym) callCounts(sym) = callCounts(sym) + 1 super.transform(tree) case _ => super.transform(tree) |