summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/transform
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2007-07-23 12:19:46 +0000
committermichelou <michelou@epfl.ch>2007-07-23 12:19:46 +0000
commit08a42368c0931dea170b7320cc1bc5389a275548 (patch)
tree5f1df0a7bd60bf3d4e0849b96c49583026d3b3d8 /src/compiler/scala/tools/nsc/transform
parent2ec28d164c1c0f94e8e340f4fbf8045d2ab6520c (diff)
downloadscala-08a42368c0931dea170b7320cc1bc5389a275548.tar.gz
scala-08a42368c0931dea170b7320cc1bc5389a275548.tar.bz2
scala-08a42368c0931dea170b7320cc1bc5389a275548.zip
removed some more type aliases
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform')
-rw-r--r--src/compiler/scala/tools/nsc/transform/Erasure.scala18
-rw-r--r--src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala11
-rw-r--r--src/compiler/scala/tools/nsc/transform/Flatten.scala5
-rw-r--r--src/compiler/scala/tools/nsc/transform/LambdaLift.scala26
-rw-r--r--src/compiler/scala/tools/nsc/transform/Mixin.scala19
-rw-r--r--src/compiler/scala/tools/nsc/transform/OverridingPairs.scala5
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala4
7 files changed, 46 insertions, 42 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala
index b1e3f77994..09cfa4a627 100644
--- a/src/compiler/scala/tools/nsc/transform/Erasure.scala
+++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -1,5 +1,5 @@
/* NSC -- new Scala compiler
- * Copyright 2005-2006 LAMP/EPFL
+ * Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
// $Id$
@@ -551,10 +551,10 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
* </li>
* </ul>
*/
- private def checkNoDoubleDefs(root: Symbol): unit = {
- def doubleDefError(sym1: Symbol, sym2: Symbol): unit = {
- val tpe1 = atPhase(currentRun.refchecksPhase.next)(root.thisType.memberType(sym1));
- val tpe2 = atPhase(currentRun.refchecksPhase.next)(root.thisType.memberType(sym2));
+ private def checkNoDoubleDefs(root: Symbol) {
+ def doubleDefError(sym1: Symbol, sym2: Symbol) {
+ val tpe1 = atPhase(currentRun.refchecksPhase.next)(root.thisType.memberType(sym1))
+ val tpe2 = atPhase(currentRun.refchecksPhase.next)(root.thisType.memberType(sym2))
unit.error(
if (sym1.owner == root) sym1.pos else root.pos,
(if (sym1.owner == sym2.owner) "double definition:\n"
@@ -583,9 +583,9 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
}
val opc = new overridingPairs.Cursor(root) {
- override def exclude(sym: Symbol): boolean =
+ override def exclude(sym: Symbol): Boolean =
!sym.isTerm || (sym hasFlag (PRIVATE | BRIDGE)) || super.exclude(sym)
- override def matches(sym1: Symbol, sym2: Symbol): boolean =
+ override def matches(sym1: Symbol, sym2: Symbol): Boolean =
atPhase(phase.next)(sym1.tpe =:= sym2.tpe)
}
while (opc.hasNext) {
@@ -647,7 +647,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
val opc = atPhase(currentRun.explicitOuterPhase) {
new overridingPairs.Cursor(owner) {
override def parents: List[Type] = List(owner.info.parents.head)
- override def exclude(sym: Symbol): boolean =
+ override def exclude(sym: Symbol): Boolean =
!sym.isMethod || (sym hasFlag (PRIVATE | BRIDGE)) || super.exclude(sym)
}
}
@@ -764,7 +764,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
// leave all other type tests/type casts, remove all other type applications
fun
case Apply(fn, args) =>
- def isGenericArray(tpe: Type): boolean = erasure(tpe).typeSymbol == BoxedArrayClass
+ def isGenericArray(tpe: Type): Boolean = erasure(tpe).typeSymbol == BoxedArrayClass
if (fn.hasSymbol &&
fn.symbol.name == nme.arraycopy &&
fn.symbol.owner.name == nme.System.toTypeName &&
diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
index 5a247a96ac..d0e2bf1eca 100644
--- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
+++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
@@ -1,5 +1,5 @@
/* NSC -- new Scala compiler
- * Copyright 2005-2006 LAMP/EPFL
+ * Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
// $Id$
@@ -451,16 +451,15 @@ abstract class ExplicitOuter extends InfoTransform with TransMatcher with Patter
null
}
case _ =>
- val x = super.transform(tree)
+ val x = super.transform(tree)
- if(x.tpe eq null) x else {
- x setType transformInfo(currentOwner, x.tpe)
- }
+ if (x.tpe eq null) x
+ else x setType transformInfo(currentOwner, x.tpe)
}
}
/** The transformation method for whole compilation units */
- override def transformUnit(unit: CompilationUnit): unit = {
+ override def transformUnit(unit: CompilationUnit) {
cunit = unit
atPhase(phase.next) { super.transformUnit(unit) }
}
diff --git a/src/compiler/scala/tools/nsc/transform/Flatten.scala b/src/compiler/scala/tools/nsc/transform/Flatten.scala
index 1c538dcbf6..b66be5d98c 100644
--- a/src/compiler/scala/tools/nsc/transform/Flatten.scala
+++ b/src/compiler/scala/tools/nsc/transform/Flatten.scala
@@ -1,5 +1,5 @@
/* NSC -- new Scala compiler
- * Copyright 2005-2006 LAMP/EPFL
+ * Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
// $Id$
@@ -18,7 +18,7 @@ abstract class Flatten extends InfoTransform {
/** the following two members override abstract members in Transform */
val phaseName: String = "flatten"
- private def liftClass(sym: Symbol): unit =
+ private def liftClass(sym: Symbol) {
if (!(sym hasFlag LIFTED)) {
sym setFlag LIFTED
atPhase(phase.next) {
@@ -30,6 +30,7 @@ abstract class Flatten extends InfoTransform {
scope enter sym
}
}
+ }
private val flattened = new TypeMap {
def apply(tp: Type): Type = tp match {
diff --git a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
index 9a6ae62539..925f1e8e61 100644
--- a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
+++ b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
@@ -1,5 +1,5 @@
/* NSC -- new Scala compiler
- * Copyright 2005-2006 LAMP/EPFL
+ * Copyright 2005-2007 LAMP/EPFL
* @author
*/
// $Id$
@@ -57,7 +57,7 @@ abstract class LambdaLift extends InfoTransform {
private val renamable = newSymSet
/** A flag to indicate whether new free variables have been found */
- private var changedFreeVars: boolean = _
+ private var changedFreeVars: Boolean = _
/** Buffers for lifted out classes and methods */
private val liftedDefs = new HashMap[Symbol, ListBuffer[Tree]]
@@ -138,7 +138,7 @@ abstract class LambdaLift extends InfoTransform {
* }
* }
*/
- private def markFree(sym: Symbol, owner: Symbol): boolean = {
+ private def markFree(sym: Symbol, owner: Symbol): Boolean = {
if (settings.debug.value)
log("mark " + sym + " of " + sym.owner + " free in " + owner)
if (owner == enclMethOrClass(sym.owner)) true
@@ -163,7 +163,7 @@ abstract class LambdaLift extends InfoTransform {
}
}
- private def markCalled(sym: Symbol, owner: Symbol): unit = {
+ private def markCalled(sym: Symbol, owner: Symbol) {
if (settings.debug.value)
log("mark " + sym + " of " + sym.owner + " called by " + owner);
symSet(called, owner) addEntry sym
@@ -188,7 +188,7 @@ abstract class LambdaLift extends InfoTransform {
/** The traverse function */
private val freeVarTraverser = new Traverser {
- override def traverse(tree: Tree): unit = {
+ override def traverse(tree: Tree) {
try { //debug
val sym = tree.symbol;
tree match {
@@ -232,28 +232,28 @@ abstract class LambdaLift extends InfoTransform {
* value/variable/let that are free in some function or class, and to
* all class/function symbols that are owned by some function.
*/
- private def computeFreeVars: unit = {
+ private def computeFreeVars {
freeVarTraverser.traverse(unit.body)
do {
changedFreeVars = false
- for (val caller <- called.keys;
- val callee <- called(caller).elements;
- val fv <- freeVars(callee))
+ for (caller <- called.keys;
+ callee <- called(caller).elements;
+ fv <- freeVars(callee))
markFree(fv, caller)
} while (changedFreeVars);
- for (val sym <- renamable.elements) {
+ for (sym <- renamable.elements) {
sym.name = unit.fresh.newName(sym.name.toString() + "$")
if (settings.debug.value) log("renamed: " + sym.name)
}
atPhase(phase.next) {
- for (val owner <- free.keys) {
+ for (owner <- free.keys) {
if (settings.debug.value)
log("free(" + owner + owner.locationString + ") = " + free(owner).elements.toList);
proxies(owner) =
- for (val fv <- free(owner).elements.toList) yield {
+ for (fv <- free(owner).elements.toList) yield {
val proxy = owner.newValue(owner.pos, fv.name)
.setFlag(if (owner.isClass) PARAMACCESSOR | PRIVATE | LOCAL else PARAM)
.setFlag(SYNTHETIC)
@@ -411,7 +411,7 @@ abstract class LambdaLift extends InfoTransform {
super.transformStats(stats, exprOwner) map addLifted
}
- override def transformUnit(unit: CompilationUnit): unit = {
+ override def transformUnit(unit: CompilationUnit) {
computeFreeVars
atPhase(phase.next)(super.transformUnit(unit))
assert(liftedDefs.size == 0, liftedDefs.keys.toList)
diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala
index 7e1984e34e..e4cd3c4f43 100644
--- a/src/compiler/scala/tools/nsc/transform/Mixin.scala
+++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala
@@ -1,5 +1,5 @@
/* NSC -- new Scala compiler
- * Copyright 2005-2006 LAMP/EPFL
+ * Copyright 2005-2007 LAMP/EPFL
* @author Martin Odersky
*/
// $Id$
@@ -21,7 +21,7 @@ abstract class Mixin extends InfoTransform {
val phaseName: String = "mixin"
/** The phase might set the fiollowing new flags: */
- override def phaseNewFlags: long = lateMODULE | notABSTRACT
+ override def phaseNewFlags: Long = lateMODULE | notABSTRACT
/** This map contains a binding (class -> info) if
* the class with this info at phase mixinPhase has been treated for mixin composition
@@ -130,7 +130,7 @@ abstract class Mixin extends InfoTransform {
*
* @param clazz ...
*/
- def addLateInterfaceMembers(clazz: Symbol): unit =
+ def addLateInterfaceMembers(clazz: Symbol) {
if ((treatedClassInfos get clazz) != Some(clazz.info)) {
treatedClassInfos(clazz) = clazz.info
assert(phase == currentRun.mixinPhase)
@@ -169,6 +169,7 @@ abstract class Mixin extends InfoTransform {
}
if (settings.debug.value) log("new defs of " + clazz + " = " + clazz.info.decls);
}
+ }
/** Map a lazy, mixedin field accessor to it's trait member accessor */
val initializer = new HashMap[Symbol, Symbol]
@@ -184,7 +185,7 @@ abstract class Mixin extends InfoTransform {
* - for every super accessor in T, add an implementation of that accessor
* - for every module in T, add a module
*/
- def addMixedinMembers(clazz: Symbol): unit = {
+ def addMixedinMembers(clazz: Symbol) {
if (!(clazz hasFlag JAVA) && (treatedClassInfos get clazz) != Some(clazz.info)) {
treatedClassInfos(clazz) = clazz.info
@@ -197,7 +198,7 @@ abstract class Mixin extends InfoTransform {
//Console.println("adding members of " + clazz.info.baseClasses.tail.takeWhile(superclazz !=) + " to " + clazz);//DEBUG
/** Mix in members of implementation class mixinClass into class clazz */
- def mixinImplClassMembers(impl: Symbol, iface: Symbol): unit = {
+ def mixinImplClassMembers(impl: Symbol, iface: Symbol) {
assert (impl.isImplClass)
for (val member <- impl.info.decls.toList) {
if (isForwarded(member)) {
@@ -218,7 +219,7 @@ abstract class Mixin extends InfoTransform {
* for each lazy field in mixinClass, add a link from its mixed in member to it's
* initializer method inside the implclass.
*/
- def mixinTraitMembers(mixinClass: Symbol): unit = {
+ def mixinTraitMembers(mixinClass: Symbol) {
// For all members of a trait's interface do:
for (val member <- mixinClass.info.decls.toList) {
if ((member hasFlag ACCESSOR) &&
@@ -451,8 +452,9 @@ abstract class Mixin extends InfoTransform {
if (sym.pos == NoPosition) clazz.pos else sym.pos
/** Add tree at given position as new definition */
- def addDef(pos: Position, tree: Tree): unit =
+ def addDef(pos: Position, tree: Tree) {
newDefs += attributedDef(pos, tree)
+ }
/** Add new method definition.
*
@@ -460,8 +462,9 @@ abstract class Mixin extends InfoTransform {
* @param rhs A function that maps formal parameters to the method's
* right-hand side
*/
- def addDefDef(sym: Symbol, rhs: List[Symbol] => Tree): unit =
+ def addDefDef(sym: Symbol, rhs: List[Symbol] => Tree) {
addDef(position(sym), DefDef(sym, vparamss => rhs(vparamss.head)))
+ }
/** Add `newdefs' to `stats', removing any abstract method definitions
* in <code>stats</code> that are matched by some symbol defined in
diff --git a/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala b/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala
index e5d5e50a39..865d988cae 100644
--- a/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala
+++ b/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala
@@ -69,7 +69,7 @@ abstract class OverridingPairs {
private val size = base.info.baseClasses.length
- private val index = new HashMap[Symbol, int]
+ private val index = new HashMap[Symbol, Int]
{ var i = 0
for (bc <- base.info.baseClasses) {
@@ -108,7 +108,7 @@ abstract class OverridingPairs {
//@M: note that next is called once during object initialisation
def hasNext: Boolean = curEntry ne null
- def next: unit =
+ def next {
if (curEntry ne null) {
overriding = curEntry.sym
if (nextEntry ne null) {
@@ -133,6 +133,7 @@ abstract class OverridingPairs {
next
}
}
+ }
next //@M: ATTN! this method gets called during construction!
}
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index 2e6e99bd6c..812896337f 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -113,7 +113,7 @@ abstract class UnCurry extends InfoTransform with TypingTransformers {
* x.apply()? Note that this is not the case if `x' is used as an argument to another
* call by name parameter.
*/
- def isByNameRef(tree: Tree): boolean =
+ def isByNameRef(tree: Tree): Boolean =
tree.isTerm && tree.hasSymbol &&
tree.symbol.tpe.typeSymbol == ByNameParamClass &&
!byNameArgs.contains(tree)
@@ -350,7 +350,7 @@ abstract class UnCurry extends InfoTransform with TypingTransformers {
t
}
- def withInConstructorFlag(inConstructorFlag: long)(f: => Tree): Tree = {
+ def withInConstructorFlag(inConstructorFlag: Long)(f: => Tree): Tree = {
val savedInConstructorFlag = this.inConstructorFlag
this.inConstructorFlag = inConstructorFlag
val t = f