diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-11-25 22:00:11 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-12-06 23:17:26 +0100 |
commit | 0ebf72b9498108e67c2133c6522c436af50a18e8 (patch) | |
tree | a7d992954695d2ca6ec7b1f1a190ff677018fb16 /src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala | |
parent | 40063b0009d55ed527bf1625d99a168a8faa4124 (diff) | |
download | scala-0ebf72b9498108e67c2133c6522c436af50a18e8.tar.gz scala-0ebf72b9498108e67c2133c6522c436af50a18e8.tar.bz2 scala-0ebf72b9498108e67c2133c6522c436af50a18e8.zip |
introduces global.pendingSuperCall
Similarly to global.emptyValDef, which is a dummy that stands for an
empty self-type, this commit introduces global.pendingSuperCall, which
stands for a yet-to-be-filled-in call to a superclass constructor.
pendingSuperCall is emitted by Parsers.template, treated specially by
Typers.typedParentType and replaced with a real superclass ctor call
by Typers.typedTemplate.
To avoid copy/paste, this commit also factors out and unifies dumminess
of EmptyTree, emptyValDef and pendingSuperCall - they all don't have a
position and actively refuse to gain one, same story for tpe.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala b/src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala index fa2913bee3..0a1d3bfa7a 100644 --- a/src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala +++ b/src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala @@ -21,12 +21,14 @@ trait StdAttachments { */ case class SuperCallArgsAttachment(argss: List[List[Tree]]) - /** Extractor for `SuperCallArgsAttachment`. + /** Convenience method for `SuperCallArgsAttachment`. * Compared with `MacroRuntimeAttachment` this attachment has different a usage pattern, * so it really benefits from a dedicated extractor. */ - object CarriesSuperCallArgs { - def unapply(tree: Tree): Option[List[List[Tree]]] = - tree.attachments.get[SuperCallArgsAttachment] collect { case SuperCallArgsAttachment(argss) => argss } - } + def superCallArgs(tree: Tree): Option[List[List[Tree]]] = + tree.attachments.get[SuperCallArgsAttachment] collect { case SuperCallArgsAttachment(argss) => argss } + + /** Determines whether the given tree has an associated SuperCallArgsAttachment. + */ + def hasSuperArgs(tree: Tree): Boolean = superCallArgs(tree).nonEmpty }
\ No newline at end of file |