summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@epfl.ch>2009-06-11 11:07:36 +0000
committerLukas Rytz <lukas.rytz@epfl.ch>2009-06-11 11:07:36 +0000
commitc762ae353b9ff8beec6ed9516b70134e1f04534d (patch)
tree943b68a997b25e8b4004c18997b75925764706f2 /src/compiler/scala/tools/nsc/typechecker
parent9e8835d617f1176290ad83691146af1f14f6faff (diff)
downloadscala-c762ae353b9ff8beec6ed9516b70134e1f04534d.tar.gz
scala-c762ae353b9ff8beec6ed9516b70134e1f04534d.tar.bz2
scala-c762ae353b9ff8beec6ed9516b70134e1f04534d.zip
more annotations cleanup.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala25
3 files changed, 15 insertions, 16 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 626dbe00bd..5f490592f5 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -768,7 +768,7 @@ trait Namers { self: Analyzer =>
}
}
- // AnnotatedTypes can contain trees in the AnnotationArguments. When accessing a
+ // AnnotatedTypes can contain trees in the annotation arguments. When accessing a
// parameter in an annotation, set the type of the Ident to the DeBruijnIndex
object treeTrans extends TypeMapTransformer {
override def transform(tree: Tree): Tree =
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index c11b157208..2015716aae 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -846,11 +846,11 @@ abstract class RefChecks extends InfoTransform {
tree match {
case m: MemberDef =>
checkAnnotations(m.symbol.annotations.map(a => (a.atp, tree.pos)))
- transformTrees(m.symbol.annotations.flatMap(a => a.args.map(_.intTree)))
+ transformTrees(m.symbol.annotations.flatMap(_.args))
case TypeTree() => doTypeTraversal {
case AnnotatedType(annots, _, _) =>
checkAnnotations(annots.map(a => (a.atp, tree.pos)))
- transformTrees(annots.flatMap(a => a.args.map(_.intTree)))
+ transformTrees(annots.flatMap(_.args))
case _ =>
}
case _ =>
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 4255fd54e2..2e8032d10a 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -2035,7 +2035,7 @@ trait Typers { self: Analyzer =>
else {
assert(isNamedApplyBlock(fun1), fun1)
val NamedApplyInfo(qual, targs, previousArgss, _) =
- context.namedApplyBlockInfo.get._2
+ context.namedApplyBlockInfo.get._2
val (allArgs, missing) = addDefaults(args, qual, targs, previousArgss, mt.params)
if (allArgs.length == formals.length) {
// a default for each missing argument was found
@@ -2279,17 +2279,17 @@ trait Typers { self: Analyzer =>
None
}
- /** Converts an untyped tree to a ConstantAnnotationArgument. If the conversion fails,
+ /** Converts an untyped tree to a ClassfileAnnotArg. If the conversion fails,
* an error message is reporded and None is returned.
*/
- def tree2ConstArg(tree: Tree, pt: Type): Option[ConstantAnnotationArgument] = tree match {
+ def tree2ConstArg(tree: Tree, pt: Type): Option[ClassfileAnnotArg] = tree match {
case ann @ Apply(Select(New(tpt), nme.CONSTRUCTOR), args) =>
val annInfo = typedAnnotation(ann, mode, NoSymbol, pt.typeSymbol, true)
if (annInfo.atp.isErroneous) {
// recursive typedAnnotation call already printed an error, so don't call "error"
hasError = true
None
- } else Some(NestedAnnotationArgument(annInfo))
+ } else Some(NestedAnnotArg(annInfo))
// use of: object Array.apply[A <: AnyRef](args: A*): Array[A] = ...
// and object Array.apply(args: Int*): Array[Int] = ... (and similar)
@@ -2307,18 +2307,17 @@ trait Typers { self: Analyzer =>
case tree => typed(tree, EXPRmode, pt) match {
case l @ Literal(c) if !l.isErroneous =>
- Some(LiteralAnnotationArgument(c))
+ Some(LiteralAnnotArg(c))
case _ =>
needConst(tree)
}
}
- def trees2ConstArg(trees: List[Tree], pt: Type): Option[ArrayAnnotationArgument] = {
+ def trees2ConstArg(trees: List[Tree], pt: Type): Option[ArrayAnnotArg] = {
val args = trees.map(tree2ConstArg(_, pt))
if (args.exists(_.isEmpty)) None
- else Some(ArrayAnnotationArgument(args.map(_.get).toArray))
+ else Some(ArrayAnnotArg(args.map(_.get).toArray))
}
-
// begin typedAnnotation
val (fun, argss) = {
def extract(fun: Tree, outerArgss: List[List[Tree]]):
@@ -2424,7 +2423,7 @@ trait Typers { self: Analyzer =>
def annInfo(t: Tree): AnnotationInfo = t match {
case Apply(Select(New(tpt), nme.CONSTRUCTOR), args) =>
- AnnotationInfo(annType, args.map(AnnotationArgument(_)), List())
+ AnnotationInfo(annType, args, List())
case Block(stats, expr) =>
context.warning(t.pos, "Usage of named or default arguments transformed this annotation\n"+
@@ -2581,15 +2580,15 @@ trait Typers { self: Analyzer =>
case ExistentialType(tparams, _) =>
boundSyms ++= tparams
case AnnotatedType(annots, _, _) =>
- for (annot <- annots; arg <- annot.args; t <- arg.intTree) {
- t match {
+ for (annot <- annots; arg <- annot.args) {
+ arg match {
case Ident(_) =>
// Check the symbol of an Ident, unless the
// Ident's type is already over an existential.
// (If the type is already over an existential,
// then remap the type, not the core symbol.)
- if (!t.tpe.typeSymbol.hasFlag(EXISTENTIAL))
- addIfLocal(t.symbol, t.tpe)
+ if (!arg.tpe.typeSymbol.hasFlag(EXISTENTIAL))
+ addIfLocal(arg.symbol, arg.tpe)
case _ => ()
}
}