@@ -308,25 +308,12 @@ object Trees {
308
308
/** Tree defines a new symbol */
309
309
trait DefTree [- T >: Untyped ] extends DenotingTree [T ] {
310
310
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 ]
322
311
323
312
private [this ] var myMods : untpd.Modifiers = null
324
313
325
314
private [dotc] def rawMods : untpd.Modifiers =
326
315
if (myMods == null ) untpd.EmptyModifiers else myMods
327
316
328
- def rawComment : Option [Comment ] = getAttachment(DocComment )
329
-
330
317
def withAnnotations (annots : List [untpd.Tree ]): ThisTree [Untyped ] = withMods(rawMods.withAnnotations(annots))
331
318
332
319
def withMods (mods : untpd.Modifiers ): ThisTree [Untyped ] = {
@@ -338,14 +325,28 @@ object Trees {
338
325
def withFlags (flags : FlagSet ): ThisTree [Untyped ] = withMods(untpd.Modifiers (flags))
339
326
def withAddedFlags (flags : FlagSet ): ThisTree [Untyped ] = withMods(rawMods | flags)
340
327
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
+
341
345
def setComment (comment : Option [Comment ]): this .type = {
342
346
comment.map(putAttachment(DocComment , _))
343
347
this
344
348
}
345
349
346
- /** Destructively update modifiers. To be used with care. */
347
- def setMods (mods : untpd.Modifiers ): Unit = myMods = mods
348
-
349
350
/** The position of the name defined by this definition.
350
351
* This is a point position if the definition is synthetic, or a range position
351
352
* if the definition comes from source.
0 commit comments