@@ -308,25 +308,12 @@ object Trees {
308308 /** Tree defines a new symbol */
309309 trait DefTree [- T >: Untyped ] extends DenotingTree [T ] {
310310 type ThisTree [- T >: Untyped ] <: DefTree [T ]
311- override def isDef : Boolean = true
312- def namedType : NamedType = tpe.asInstanceOf [NamedType ]
313- }
314-
315- /** Tree defines a new symbol and carries modifiers.
316- * The position of a MemberDef contains only the defined identifier or pattern.
317- * The envelope of a MemberDef contains the whole definition and has its point
318- * on the opening keyword (or the next token after that if keyword is missing).
319- */
320- abstract class MemberDef [- T >: Untyped ](implicit @ constructorOnly src : SourceFile ) extends NameTree [T ] with DefTree [T ] {
321- type ThisTree [- T >: Untyped ] <: MemberDef [T ]
322311
323312 private [this ] var myMods : untpd.Modifiers = null
324313
325314 private [dotc] def rawMods : untpd.Modifiers =
326315 if (myMods == null ) untpd.EmptyModifiers else myMods
327316
328- def rawComment : Option [Comment ] = getAttachment(DocComment )
329-
330317 def withAnnotations (annots : List [untpd.Tree ]): ThisTree [Untyped ] = withMods(rawMods.withAnnotations(annots))
331318
332319 def withMods (mods : untpd.Modifiers ): ThisTree [Untyped ] = {
@@ -338,14 +325,28 @@ object Trees {
338325 def withFlags (flags : FlagSet ): ThisTree [Untyped ] = withMods(untpd.Modifiers (flags))
339326 def withAddedFlags (flags : FlagSet ): ThisTree [Untyped ] = withMods(rawMods | flags)
340327
328+ /** Destructively update modifiers. To be used with care. */
329+ def setMods (mods : untpd.Modifiers ): Unit = myMods = mods
330+
331+ override def isDef : Boolean = true
332+ def namedType : NamedType = tpe.asInstanceOf [NamedType ]
333+ }
334+
335+ /** Tree defines a new symbol and carries modifiers.
336+ * The position of a MemberDef contains only the defined identifier or pattern.
337+ * The envelope of a MemberDef contains the whole definition and has its point
338+ * on the opening keyword (or the next token after that if keyword is missing).
339+ */
340+ abstract class MemberDef [- T >: Untyped ](implicit @ constructorOnly src : SourceFile ) extends NameTree [T ] with DefTree [T ] {
341+ type ThisTree [- T >: Untyped ] <: MemberDef [T ]
342+
343+ def rawComment : Option [Comment ] = getAttachment(DocComment )
344+
341345 def setComment (comment : Option [Comment ]): this .type = {
342346 comment.map(putAttachment(DocComment , _))
343347 this
344348 }
345349
346- /** Destructively update modifiers. To be used with care. */
347- def setMods (mods : untpd.Modifiers ): Unit = myMods = mods
348-
349350 /** The position of the name defined by this definition.
350351 * This is a point position if the definition is synthetic, or a range position
351352 * if the definition comes from source.
0 commit comments