diff options
author | Paul Phillips <paulp@improving.org> | 2010-11-04 00:07:36 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-11-04 00:07:36 +0000 |
commit | 379af580e2c8cf0ce5309fc0b31702f79e415abe (patch) | |
tree | cf741eb0d27624d6130bb5bc7f403ec7fb05af1d /src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala | |
parent | de012b3a6d04f1e7a9fd6fecd403e0492f6ad7c1 (diff) | |
download | scala-379af580e2c8cf0ce5309fc0b31702f79e415abe.tar.gz scala-379af580e2c8cf0ce5309fc0b31702f79e415abe.tar.bz2 scala-379af580e2c8cf0ce5309fc0b31702f79e415abe.zip |
Determined that half a dozen ways of checking f...
Determined that half a dozen ways of checking for varargs and
by-name-ness in param lists exceeded the legal limit. Also assessed that
names which are only used as type names would be a lot easier to deal
with if we created them as type names up front. Performed the changes
implied by the preceding along with a partial cleanup on TreeInfo which
one can see hasn't had a good look in a long time. (And still hasn't.)
No review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala index 04c6dbe4a0..151a851f23 100644 --- a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala +++ b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala @@ -250,10 +250,10 @@ trait NamesDefaults { self: Analyzer => def argValDefs(args: List[Tree], paramTypes: List[Type], blockTyper: Typer): List[ValDef] = { val context = blockTyper.context val symPs = (args, paramTypes).zipped map ((arg, tpe) => { - val byName = tpe.typeSymbol == ByNameParamClass + val byName = isByNameParamType(tpe) val (argTpe, repeated) = - if (tpe.typeSymbol == RepeatedParamClass) arg match { - case Typed(expr, tpt @ Ident(name)) if name == nme.WILDCARD_STAR.toTypeName => + if (isScalaRepeatedParamType(tpe)) arg match { + case Typed(expr, Ident(nme.WILDCARD_STAR)) => (expr.tpe, true) case _ => (seqType(arg.tpe), true) @@ -271,7 +271,7 @@ trait NamesDefaults { self: Analyzer => // () => { val x = 1; x }, the owner of symbol x must change (to the apply method of the function). val body = if (byName) blockTyper.typed(Function(List(), resetLocalAttrs(arg))) else if (repeated) arg match { - case Typed(expr, tpt @ Ident(name)) if name == nme.WILDCARD_STAR.toTypeName => + case Typed(expr, Ident(nme.WILDCARD_STAR)) => expr case _ => val factory = Select(gen.mkAttributedRef(SeqModule), nme.apply) @@ -314,8 +314,8 @@ trait NamesDefaults { self: Analyzer => val ref = gen.mkAttributedRef(vDef.symbol) atPos(vDef.pos.focus) { // for by-name parameters, the local value is a nullary function returning the argument - if (tpe.typeSymbol == ByNameParamClass) Apply(ref, List()) - else if (tpe.typeSymbol == RepeatedParamClass) Typed(ref, Ident(nme.WILDCARD_STAR.toTypeName)) + if (isByNameParamType(tpe)) Apply(ref, List()) + else if (isScalaRepeatedParamType(tpe)) Typed(ref, Ident(nme.WILDCARD_STAR)) else ref } }) |