summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
diff options
context:
space:
mode:
authorLex Spoon <lex@lexspoon.org>2007-08-06 20:49:38 +0000
committerLex Spoon <lex@lexspoon.org>2007-08-06 20:49:38 +0000
commita00c8f75f17206b0a6f055d5db168415054aeb34 (patch)
tree369070030389a9cf433aaf7b0db6b825d6d433e0 /src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
parente114becbc9f1de72b6dabc8c3c84d352187a61bb (diff)
downloadscala-a00c8f75f17206b0a6f055d5db168415054aeb34.tar.gz
scala-a00c8f75f17206b0a6f055d5db168415054aeb34.tar.bz2
scala-a00c8f75f17206b0a6f055d5db168415054aeb34.zip
- annotations can follow a type in addition to ...
- annotations can follow a type in addition to preceding it - annotations are traversed by tree Traverser's - the internal representation of declaration annotations is now type checkable
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/parser/Parsers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index eb176dca42..5c2ff33243 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -763,7 +763,7 @@ trait Parsers {
}
}
- /** AnnotType ::= Annotations SimpleType
+ /** AnnotType ::= Annotations SimpleType Annotations
* SimpleType ::= SimpleType TypeArgs
* | SimpleType `#' Id
* | StableId
@@ -772,7 +772,7 @@ trait Parsers {
* | WildcardType
*/
def annotType(isPattern: Boolean): Tree = {
- val annots = annotations()
+ val annots1 = annotations() // Q: deprecate annotations here?
val pos = inCurrentPos
val t: Tree = annotTypeRest(pos, isPattern,
@@ -790,6 +790,9 @@ trait Parsers {
case _ => convertToTypeId(r)
}
})
+
+ val annots2 = annotations()
+ val annots = annots1 ::: annots2
(t /: annots) (makeAnnotated)
}
@@ -1609,11 +1612,12 @@ trait Parsers {
*/
def annotation(): Annotation = {
def nameValuePair(): Tree = {
- accept(VAL)
var pos = inCurrentPos
- val aname = atPos(pos) { Ident(ident()) }
+ accept(VAL)
+ val aname = ident()
accept(EQUALS)
- atPos(pos) { Assign(aname, stripParens(prefixExpr())) }
+ val rhs = stripParens(prefixExpr())
+ atPos(pos) { ValDef(NoMods, aname, TypeTree(), rhs) }
}
val pos = inCurrentPos
var t: Tree = convertToTypeId(stableId())