Skip to content

Commit

Permalink
Merge pull request scala#4700 from dotty-staging/decompile-fix-setters
Browse files Browse the repository at this point in the history
Do not print setters
  • Loading branch information
nicolasstucki authored Jun 22, 2018
2 parents 4725fe5 + e63bbb2 commit 89010f2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
8 changes: 4 additions & 4 deletions library/src/scala/tasty/util/ShowSourceCode.scala
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
})
}
def isInnerModuleObject = d.flags.isLazy && d.flags.isObject
!flags.isParam && !flags.isParamAccessor && !isCaseClassUnOverridableMethod && !isInnerModuleObject
!flags.isParam && !flags.isParamAccessor && !flags.isFieldAccessor && !isCaseClassUnOverridableMethod && !isInnerModuleObject
}
val stats1 = stats.collect {
case stat@Definition() if keepDefinition(stat) => stat
case stat@Import(_, _) => stat
case stat@Term() => stat
case stat @ Definition() if keepDefinition(stat) => stat
case stat @ Import(_, _) => stat
case stat @ Term() => stat
}

def printBody(printSelf: Boolean) = {
Expand Down
5 changes: 5 additions & 0 deletions tests/pos/simpleSetter.decompiled
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** Decompiled from out/posTestFromTasty/pos/simpleSetter/Test.class */
object Test {
var name: scala.Predef.String = "foo"
Test.name = Test.name.+("123")
}
4 changes: 4 additions & 0 deletions tests/pos/simpleSetter.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
object Test {
var name: String = "foo"
name = name + "123"
}

0 comments on commit 89010f2

Please sign in to comment.