diff options
author | Paul Phillips <paulp@improving.org> | 2011-06-25 21:25:12 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-06-25 21:25:12 +0000 |
commit | 924b5852faaf9074c3ba74631ad694fcc14f708a (patch) | |
tree | b675db2aa92012e7f66fc0806f0652fe3650e975 /src/compiler/scala/tools/nsc/typechecker/Implicits.scala | |
parent | 81964737687fbf8defd3c5798a48309ea19ac7ad (diff) | |
download | scala-924b5852faaf9074c3ba74631ad694fcc14f708a.tar.gz scala-924b5852faaf9074c3ba74631ad694fcc14f708a.tar.bz2 scala-924b5852faaf9074c3ba74631ad694fcc14f708a.zip |
Generalizing some TreeGen machinery on an oppor...
Generalizing some TreeGen machinery on an opportunistic basis. Better
documenting how Class types and classOf are implemented. Cleaning up the
manifest code. No review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Implicits.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Implicits.scala | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index 87bde02b94..29ca9f4a70 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -1056,15 +1056,7 @@ trait Implicits { /** Creates a tree that calls the factory method called constructor in object reflect.Manifest */ def manifestFactoryCall(constructor: String, tparg: Type, args: Tree*): Tree = if (args contains EmptyTree) EmptyTree - else typedPos(tree.pos.focus) { - Apply( - TypeApply( - Select(gen.mkAttributedRef(if (full) FullManifestModule else PartialManifestModule), constructor), - List(TypeTree(tparg)) - ), - args.toList - ) - } + else typedPos(tree.pos.focus)(gen.mkManifestFactoryCall(full, constructor, tparg, args.toList)) /** Creates a tree representing one of the singleton manifests.*/ def findSingletonManifest(name: String) = typedPos(tree.pos.focus) { @@ -1097,13 +1089,12 @@ trait Implicits { manifestFactoryCall("arrayType", args.head, findManifest(args.head)) } else if (sym.isClass) { val classarg0 = gen.mkClassOf(tp1) - val classarg = tp match { - case ExistentialType(_, _) => - TypeApply(Select(classarg0, Any_asInstanceOf), - List(TypeTree(appliedType(ClassClass.typeConstructor, List(tp))))) - case _ => + val classarg = ( + if (tp.isInstanceOf[ExistentialType]) + TypeApply(Select(classarg0, Any_asInstanceOf), List(TypeTree(ClassType(tp)))) + else classarg0 - } + ) val suffix = classarg :: (args map findSubManifest) manifestFactoryCall( "classType", tp, |