@@ -72,7 +72,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
72
72
case tree @ PackageClause (name, stats) =>
73
73
val stats1 = stats.collect {
74
74
case IsPackageClause (stat) => stat
75
- case IsDefinition (stat) if ! (stat.flags.isObject && stat.flags.isLazy) => stat
75
+ case IsDefinition (stat) if ! (stat.symbol. flags.isObject && stat.symbol .flags.isLazy) => stat
76
76
case stat @ Import (_, _) => stat
77
77
}
78
78
name match {
@@ -93,14 +93,14 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
93
93
case IsClassDef (cdef @ ClassDef (name, DefDef (_, targs, argss, _, _), parents, self, stats)) =>
94
94
printDefAnnotations(cdef)
95
95
96
- val flags = cdef.flags
96
+ val flags = cdef.symbol. flags
97
97
if (flags.isImplicit) this += " implicit "
98
98
if (flags.isSealed) this += " sealed "
99
99
if (flags.isFinal && ! flags.isObject) this += " final "
100
100
if (flags.isCase) this += " case "
101
101
102
102
if (name == " package$" ) {
103
- this += " package object " += cdef.owner.name.stripSuffix(" $" )
103
+ this += " package object " += cdef.symbol. owner.name.stripSuffix(" $" )
104
104
}
105
105
else if (flags.isObject) this += " object " += name.stripSuffix(" $" )
106
106
else if (flags.isTrait) this += " trait " += name
@@ -148,20 +148,20 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
148
148
printSeparated(parents1)
149
149
150
150
def keepDefinition (d : Definition ): Boolean = {
151
- val flags = d.flags
151
+ val flags = d.symbol. flags
152
152
def isCaseClassUnOverridableMethod : Boolean = {
153
153
// Currently the compiler does not allow overriding some of the methods generated for case classes
154
- d.flags.isSynthetic &&
154
+ d.symbol. flags.isSynthetic &&
155
155
(d match {
156
- case DefDef (" apply" | " unapply" , _, _, _, _) if d.owner.flags.isObject => true
157
- case DefDef (n, _, _, _, _) if d.owner.flags.isCase =>
156
+ case DefDef (" apply" | " unapply" , _, _, _, _) if d.symbol. owner.flags.isObject => true
157
+ case DefDef (n, _, _, _, _) if d.symbol. owner.flags.isCase =>
158
158
n == " copy" ||
159
159
n.matches(" copy\\ $default\\ $[1-9][0-9]*" ) || // default parameters for the copy method
160
160
n.matches(" _[1-9][0-9]*" ) // Getters from Product
161
161
case _ => false
162
162
})
163
163
}
164
- def isInnerModuleObject = d.flags.isLazy && d.flags.isObject
164
+ def isInnerModuleObject = d.symbol. flags.isLazy && d.symbol .flags.isObject
165
165
! flags.isParam && ! flags.isParamAccessor && ! flags.isFieldAccessor && ! isCaseClassUnOverridableMethod && ! isInnerModuleObject
166
166
}
167
167
val stats1 = stats.collect {
@@ -207,14 +207,14 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
207
207
case IsValDef (vdef @ ValDef (name, tpt, rhs)) =>
208
208
printDefAnnotations(vdef)
209
209
210
- val flags = vdef.flags
210
+ val flags = vdef.symbol. flags
211
211
if (flags.isImplicit) this += " implicit "
212
212
if (flags.isOverride) this += " override "
213
213
214
214
printProtectedOrPrivate(vdef)
215
215
216
216
if (flags.isLazy) this += " lazy "
217
- if (vdef.flags.isMutable) this += " var "
217
+ if (vdef.symbol. flags.isMutable) this += " var "
218
218
else this += " val "
219
219
220
220
this += name += " : "
@@ -242,7 +242,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
242
242
243
243
val isConstructor = name == " <init>"
244
244
245
- val flags = ddef.flags
245
+ val flags = ddef.symbol. flags
246
246
if (flags.isImplicit) this += " implicit "
247
247
if (flags.isTransparent) this += " transparent "
248
248
if (flags.isOverride) this += " override "
@@ -359,7 +359,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
359
359
360
360
case Term .Block (stats0, expr) =>
361
361
val stats = stats0.filter {
362
- case IsValDef (tree) => ! tree.flags.isObject
362
+ case IsValDef (tree) => ! tree.symbol. flags.isObject
363
363
case _ => true
364
364
}
365
365
@@ -589,8 +589,8 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
589
589
args match {
590
590
case Nil =>
591
591
case arg :: _ =>
592
- if (arg.flags.isErased) this += " erased "
593
- if (arg.flags.isImplicit) this += " implicit "
592
+ if (arg.symbol. flags.isErased) this += " erased "
593
+ if (arg.symbol. flags.isImplicit) this += " implicit "
594
594
}
595
595
596
596
def printSeparated (list : List [ValDef ]): Unit = list match {
@@ -620,20 +620,20 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
620
620
621
621
def printParamDef (arg : ValDef ): Unit = {
622
622
val name = arg.name
623
- arg.owner match {
624
- case DefDef (" <init>" , _, _, _, _) =>
625
- val ClassDef (_, _, _, _, body) = arg.owner.owner
623
+ arg.symbol. owner.tree match {
624
+ case Some ( DefDef (" <init>" , _, _, _, _) ) =>
625
+ val Some ( ClassDef (_, _, _, _, body)) = arg.symbol. owner.owner.tree
626
626
body.collectFirst {
627
- case IsValDef (vdef @ ValDef (`name`, _, _)) if vdef.flags.isParamAccessor =>
628
- if (! vdef.flags.isLocal) {
627
+ case IsValDef (vdef @ ValDef (`name`, _, _)) if vdef.symbol. flags.isParamAccessor =>
628
+ if (! vdef.symbol. flags.isLocal) {
629
629
var printedPrefix = false
630
- if (vdef.flags.isOverride) {
630
+ if (vdef.symbol. flags.isOverride) {
631
631
this += " override "
632
632
printedPrefix = true
633
633
}
634
634
printedPrefix |= printProtectedOrPrivate(vdef)
635
- if (vdef.flags.isMutable) this += " var "
636
- else if (printedPrefix || ! vdef.flags.isCaseAcessor) this += " val "
635
+ if (vdef.symbol. flags.isMutable) this += " var "
636
+ else if (printedPrefix || ! vdef.symbol. flags.isCaseAcessor) this += " val "
637
637
else this // val not explicitly needed
638
638
}
639
639
}
@@ -955,7 +955,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
955
955
}
956
956
957
957
def printDefAnnotations (definition : Definition ): Buffer = {
958
- val annots = definition.annots.filter {
958
+ val annots = definition.symbol. annots.filter {
959
959
case Annotation (annot, _) =>
960
960
annot.tpe match {
961
961
case Type .TypeRef (_, Type .SymRef (sym, _)) if sym.fullName == " scala.annotation.internal" => false
@@ -1059,16 +1059,16 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
1059
1059
this += sym.name
1060
1060
case _ => printFullClassName(within)
1061
1061
}
1062
- if (definition.flags.isProtected) {
1062
+ if (definition.symbol. flags.isProtected) {
1063
1063
this += " protected"
1064
- definition.protectedWithin match {
1064
+ definition.symbol. protectedWithin match {
1065
1065
case Some (within) =>
1066
1066
inSquare(printWithin(within))
1067
1067
case _ =>
1068
1068
}
1069
1069
prefixWasPrinted = true
1070
1070
} else {
1071
- definition.privateWithin match {
1071
+ definition.symbol. privateWithin match {
1072
1072
case Some (within) =>
1073
1073
this += " private"
1074
1074
inSquare(printWithin(within))
0 commit comments