diff options
author | Martin Odersky <odersky@gmail.com> | 2006-01-20 15:50:55 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2006-01-20 15:50:55 +0000 |
commit | 3ba2f2b49e0635255bbb40958e05cc5dccde0424 (patch) | |
tree | bafa0a461bae7046be9285146b326a7d2685483c /src/compiler/scala/tools/nsc/typechecker/Typers.scala | |
parent | 79fab589462c093512d1c5c37adc6fdc28cd86b0 (diff) | |
download | scala-3ba2f2b49e0635255bbb40958e05cc5dccde0424.tar.gz scala-3ba2f2b49e0635255bbb40958e05cc5dccde0424.tar.bz2 scala-3ba2f2b49e0635255bbb40958e05cc5dccde0424.zip |
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 7aa79333d9..cb83e6abbe 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -240,17 +240,6 @@ mixin class Typers requires Analyzer { tparam.symbol.deSkolemize } - def attrInfo(attr: Tree): AttrInfo = attr match { - case Apply(Select(New(tpt), nme.CONSTRUCTOR), args) => - Pair(tpt.tpe, args map { - case Literal(value) => - value - case arg => - error(arg.pos, "attribute argument needs to be a constant; found: "+arg) - null - }) - } - /** The qualifying class of a this or super with prefix `qual' */ def qualifyingClassContext(tree: Tree, qual: Name): Context = { if (qual.isEmpty) { @@ -1164,10 +1153,22 @@ mixin class Typers requires Analyzer { case Attributed(attr, defn) => val attr1 = typed(attr, AttributeClass.tpe) - val defn1 = typed(defn, mode, pt) - val ai = attrInfo(attr1) - if (ai != null) defn1.symbol.attributes = defn1.symbol.attributes ::: List(ai) - defn1 + val attrInfo = attr1 match { + case Apply(Select(New(tpt), nme.CONSTRUCTOR), args) => + Pair(tpt.tpe, args map { + case Literal(value) => + value + case arg => + error(arg.pos, "attribute argument needs to be a constant; found: "+arg) + null + }) + } + if (attrInfo != null) { + val attributed = + if (defn.symbol.isModule) defn.symbol.moduleClass else defn.symbol; + attributed.attributes = attributed.attributes ::: List(attrInfo) + } + typed(defn, mode, pt) case DocDef(comment, defn) => typed(defn, mode, pt) |