diff options
author | Paul Phillips <paulp@improving.org> | 2011-06-25 21:24:35 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-06-25 21:24:35 +0000 |
commit | 7b7b242299fa4f8e8f201aefc41eb4270babe398 (patch) | |
tree | 1eb7ef30ed42610314d8302a195bb4de3a01a565 /src | |
parent | d8912db1436a42474ddd45007569246ee2af9000 (diff) | |
download | scala-7b7b242299fa4f8e8f201aefc41eb4270babe398.tar.gz scala-7b7b242299fa4f8e8f201aefc41eb4270babe398.tar.bz2 scala-7b7b242299fa4f8e8f201aefc41eb4270babe398.zip |
Cosmetic removal of redundant toList call on it...
Cosmetic removal of redundant toList call on iterable target, no review.
Diffstat (limited to 'src')
13 files changed, 22 insertions, 25 deletions
diff --git a/src/compiler/scala/reflect/internal/Symbols.scala b/src/compiler/scala/reflect/internal/Symbols.scala index 0465738e4b..42d15f56ad 100644 --- a/src/compiler/scala/reflect/internal/Symbols.scala +++ b/src/compiler/scala/reflect/internal/Symbols.scala @@ -984,7 +984,7 @@ trait Symbols /* extends reflect.generic.Symbols*/ { self: SymbolTable => val thistp = tp.typeSymbol.thisType val oldsymbuf = new ListBuffer[Symbol] val newsymbuf = new ListBuffer[Symbol] - for (sym <- info.decls.toList) { + for (sym <- info.decls) { // todo: what about public references to private symbols? if (sym.isPublic && !sym.isConstructor) { oldsymbuf += sym diff --git a/src/compiler/scala/reflect/internal/Types.scala b/src/compiler/scala/reflect/internal/Types.scala index ba4547a3b8..6152cd70f5 100644 --- a/src/compiler/scala/reflect/internal/Types.scala +++ b/src/compiler/scala/reflect/internal/Types.scala @@ -1411,7 +1411,7 @@ trait Types /*extends reflect.generic.Types*/ { self: SymbolTable => override def isStructuralRefinement: Boolean = typeSymbol.isAnonOrRefinementClass && - (decls.toList exists { entry => !entry.isConstructor && entry.allOverriddenSymbols.isEmpty }) + (decls exists { entry => !entry.isConstructor && entry.allOverriddenSymbols.isEmpty }) // override def isNullable: Boolean = // parents forall (p => p.isNullable && !p.typeSymbol.isAbstractType); @@ -2019,7 +2019,7 @@ A type's typeSymbol should never be inspected directly. else if (sym.isAnonymousClass && sym.isInitialized && !settings.debug.value && !phase.erasedTypes) thisInfo.parents.mkString(" with ") + { if (sym.isStructuralRefinement) - ((decls.toList filter { entry => + ((decls filter { entry => !entry.isConstructor && entry.allOverriddenSymbols.isEmpty && !entry.isPrivate }) map { entry => entry.defString }).mkString("{", "; ", "}") else @@ -4744,7 +4744,7 @@ A type's typeSymbol should never be inspected directly. thirdTryRef(tp1, tr2) case rt2: RefinedType => (rt2.parents forall (tp1 <:< _)) && - (rt2.decls.toList forall tp1.specializes) + (rt2.decls forall tp1.specializes) case et2: ExistentialType => et2.withTypeVars(tp1 <:< _, depth) || fourthTry case nn2: NotNullType => diff --git a/src/compiler/scala/tools/nsc/ast/NodePrinters.scala b/src/compiler/scala/tools/nsc/ast/NodePrinters.scala index ca4ccd4f35..ea51fc0141 100644 --- a/src/compiler/scala/tools/nsc/ast/NodePrinters.scala +++ b/src/compiler/scala/tools/nsc/ast/NodePrinters.scala @@ -92,7 +92,7 @@ abstract class NodePrinters { !(sym.owner eq definitions.ScalaPackageClass) && !sym.isModuleClass && !sym.isPackageClass && !sym.isJavaDefined) { - val members = for (m <- tree.tpe.decls.toList) + val members = for (m <- tree.tpe.decls) yield m.toString() + ": " + m.tpe + ", " buf.append(", tpe.decls=" + members) } diff --git a/src/compiler/scala/tools/nsc/interpreter/Power.scala b/src/compiler/scala/tools/nsc/interpreter/Power.scala index 5fb756c26c..d907d5024f 100644 --- a/src/compiler/scala/tools/nsc/interpreter/Power.scala +++ b/src/compiler/scala/tools/nsc/interpreter/Power.scala @@ -212,7 +212,7 @@ abstract class Power[G <: Global]( } def ? = this - def whoHas(name: String) = bts filter (_.decls.toList exists (_.name.toString == name)) + def whoHas(name: String) = bts filter (_.decls exists (_.name.toString == name)) def <:<[U: Manifest](other: U) = tpe <:< InternalInfo[U].tpe def lub[U: Manifest](other: U) = global.lub(List(tpe, InternalInfo[U].tpe)) def glb[U: Manifest](other: U) = global.glb(List(tpe, InternalInfo[U].tpe)) diff --git a/src/compiler/scala/tools/nsc/transform/Constructors.scala b/src/compiler/scala/tools/nsc/transform/Constructors.scala index 72dcd2e1da..d84e754cc1 100644 --- a/src/compiler/scala/tools/nsc/transform/Constructors.scala +++ b/src/compiler/scala/tools/nsc/transform/Constructors.scala @@ -585,11 +585,8 @@ abstract class Constructors extends Transform with ast.TreeDSL { defBuf ++= auxConstructorBuf // Unlink all fields that can be dropped from class scope - for (sym <- clazz.info.decls.toList) - if (!mustbeKept(sym)) { - // println("dropping "+sym+sym.locationString) - clazz.info.decls unlink sym - } + for (sym <- clazz.info.decls ; if !mustbeKept(sym)) + clazz.info.decls unlink sym // Eliminate all field definitions that can be dropped from template treeCopy.Template(impl, impl.parents, impl.self, diff --git a/src/compiler/scala/tools/nsc/transform/Flatten.scala b/src/compiler/scala/tools/nsc/transform/Flatten.scala index d147d408e4..28dfabb035 100644 --- a/src/compiler/scala/tools/nsc/transform/Flatten.scala +++ b/src/compiler/scala/tools/nsc/transform/Flatten.scala @@ -42,12 +42,12 @@ abstract class Flatten extends InfoTransform { var parents1 = parents val decls1 = new Scope if (clazz.isPackageClass) { - atPhase(phase.next)(decls.toList foreach (sym => decls1 enter sym)) + atPhase(phase.next)(decls foreach (decls1 enter _)) } else { val oldowner = clazz.owner atPhase(phase.next)(oldowner.info) parents1 = parents mapConserve (this) - for (sym <- decls.toList) { + for (sym <- decls) { if (sym.isTerm && !sym.isStaticModule) { decls1 enter sym if (sym.isModule) sym.moduleClass setFlag LIFTED diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala index 5ea480f4ae..c18bfb7929 100644 --- a/src/compiler/scala/tools/nsc/transform/Mixin.scala +++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala @@ -185,7 +185,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL { val impl = implClass(clazz) assert(impl != NoSymbol) - for (member <- impl.info.decls.toList) { + for (member <- impl.info.decls) { if (!member.isMethod && !member.isModule && !member.isModuleVar) { assert(member.isTerm && !member.isDeferred, member) if (member.getter(impl).isPrivate) { @@ -258,7 +258,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL { "%s (%s) is not a an implementation class, it cannot mix in %s".format( impl, impl.defaultFlagString, iface) ) - for (member <- impl.info.decls.toList) { + for (member <- impl.info.decls) { if (isForwarded(member)) { val imember = member.overriddenSymbol(iface) // atPhase(currentRun.erasurePhase){ @@ -282,7 +282,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL { */ def mixinTraitMembers(mixinClass: Symbol) { // For all members of a trait's interface do: - for (member <- mixinClass.info.decls.toList) { + for (member <- mixinClass.info.decls) { if (isConcreteAccessor(member)) { if (isOverriddenAccessor(member, clazz.info.baseClasses)) { if (settings.debug.value) @@ -576,7 +576,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL { sym.owner.owner.info //todo: needed? if (sym.owner.sourceModule == NoSymbol) assert(false, "" + sym + " in " + sym.owner + " in " + sym.owner.owner + - " " + sym.owner.owner.info.decls.toList)//debug + " " + sym.owner.owner.info.decls)//debug REF(sym.owner.sourceModule) DOT sym } @@ -1027,7 +1027,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL { } // for all symbols `sym` in the class definition, which are mixed in: - for (sym <- clazz.info.decls.toList) { + for (sym <- clazz.info.decls) { if (sym hasFlag MIXEDIN) { if (clazz hasFlag lateINTERFACE) { // if current class is a trait interface, add an abstract method for accessor `sym` diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index e6fb738dbb..6a6a173e0f 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -1546,7 +1546,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { val mbrs = new mutable.ListBuffer[Tree] var hasSpecializedFields = false - for (m <- cls.info.decls.toList + for (m <- cls.info.decls if m.hasFlag(SPECIALIZED) && (m.sourceFile ne null) && satisfiable(typeEnv(m), !cls.hasFlag(SPECIALIZED))) { diff --git a/src/compiler/scala/tools/nsc/typechecker/DeVirtualize.scala b/src/compiler/scala/tools/nsc/typechecker/DeVirtualize.scala index aac92ccb59..ab32a425c7 100644 --- a/src/compiler/scala/tools/nsc/typechecker/DeVirtualize.scala +++ b/src/compiler/scala/tools/nsc/typechecker/DeVirtualize.scala @@ -136,7 +136,7 @@ abstract class DeVirtualize /* extends InfoTransform with TypingTransformers { atPhase(ownPhase) { newTermName("new$"+clazz.name) } /** Does `clazz` contain virtual classes? */ - protected def containsVirtuals(clazz: Symbol) = clazz.info.decls.toList exists (_.isVirtualClass) + protected def containsVirtuals(clazz: Symbol) = clazz.info.decls exists (_.isVirtualClass) /** The inner classes that need factory methods in `clazz` * This is intended to catch situations like the following diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 23a7766c3e..3d5032a7c8 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -811,7 +811,7 @@ trait Namers { self: Analyzer => log( "ClassInfoType(\n%s,\n%s,\n%s)".format( " " + (parents map (_.typeSymbol) mkString ", "), - if (global.opt.debug) decls.toList map (">> " + _) mkString("\n", "\n", "") else " <decls>", + if (global.opt.debug) decls map (">> " + _) mkString("\n", "\n", "") else " <decls>", " " + clazz) ) } diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index e760164c7e..40e3aea1d7 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -632,7 +632,7 @@ abstract class RefChecks extends InfoTransform { } // 4. Check that every defined member with an `override` modifier overrides some other member. - for (member <- clazz.info.decls.toList) + for (member <- clazz.info.decls) if ((member hasFlag (OVERRIDE | ABSOVERRIDE)) && !(clazz.thisType.baseClasses exists (hasMatchingSym(_, member)))) { // for (bc <- clazz.info.baseClasses.tail) Console.println("" + bc + " has " + bc.info.decl(member.name) + ":" + bc.info.decl(member.name).tpe);//DEBUG @@ -782,7 +782,7 @@ abstract class RefChecks extends InfoTransform { validateVariances(parents, variance) case RefinedType(parents, decls) => validateVariances(parents, variance) - for (sym <- decls.toList) + for (sym <- decls) validateVariance(sym.info, if (sym.isAliasType) NoVariance else variance) case TypeBounds(lo, hi) => validateVariance(lo, -variance) diff --git a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala index 310113c7d5..f178274e3e 100644 --- a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala +++ b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala @@ -149,7 +149,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT case ClassDef(_, _, _, _) => checkCompanionNameClashes(sym) val decls = sym.info.decls - for (s <- decls.toList) { + for (s <- decls) { if (s.privateWithin.isClass && !s.privateWithin.isModuleClass && !s.hasFlag(EXPANDEDNAME) && !s.isConstructor) { decls.unlink(s) diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 4e3650bc54..84c9595e3c 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1892,7 +1892,7 @@ trait Typers extends Modes { case BoundedWildcardType(TypeBounds(lo, hi)) => lo.members case _ => pt.members } - for (member <- classDef.symbol.info.decls.toList + for (member <- classDef.symbol.info.decls if member.isTerm && !member.isConstructor && member.allOverriddenSymbols.isEmpty && (!member.isPrivate && !member.hasAccessBoundary) && |