summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2006-01-20 15:50:55 +0000
committerMartin Odersky <odersky@gmail.com>2006-01-20 15:50:55 +0000
commit3ba2f2b49e0635255bbb40958e05cc5dccde0424 (patch)
treebafa0a461bae7046be9285146b326a7d2685483c /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parent79fab589462c093512d1c5c37adc6fdc28cd86b0 (diff)
downloadscala-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.scala31
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)