Skip to content

Commit e63bbb2

Browse files
committed
Do not print setters
1 parent 90904e8 commit e63bbb2

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

library/src/scala/tasty/util/ShowSourceCode.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,12 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
141141
})
142142
}
143143
def isInnerModuleObject = d.flags.isLazy && d.flags.isObject
144-
!flags.isParam && !flags.isParamAccessor && !isCaseClassUnOverridableMethod && !isInnerModuleObject
144+
!flags.isParam && !flags.isParamAccessor && !flags.isFieldAccessor && !isCaseClassUnOverridableMethod && !isInnerModuleObject
145145
}
146146
val stats1 = stats.collect {
147-
case stat@Definition() if keepDefinition(stat) => stat
148-
case stat@Import(_, _) => stat
149-
case stat@Term() => stat
147+
case stat @ Definition() if keepDefinition(stat) => stat
148+
case stat @ Import(_, _) => stat
149+
case stat @ Term() => stat
150150
}
151151

152152
def printBody(printSelf: Boolean) = {

tests/pos/simpleSetter.decompiled

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/** Decompiled from out/posTestFromTasty/pos/simpleSetter/Test.class */
2+
object Test {
3+
var name: scala.Predef.String = "foo"
4+
Test.name = Test.name.+("123")
5+
}

tests/pos/simpleSetter.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
object Test {
2+
var name: String = "foo"
3+
name = name + "123"
4+
}

0 commit comments

Comments
 (0)