aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Flags.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-07-01 14:37:58 +0200
committerMartin Odersky <odersky@gmail.com>2014-07-17 11:01:59 +0200
commit8112a39d3a00f53a68af794d0a83cf995faf31e2 (patch)
tree1bf1754ffbec020e57566106e2042545fc9c4bd6 /src/dotty/tools/dotc/core/Flags.scala
parent0cf64e8110717ec1c1008a7cdfb5c173a3f0bc49 (diff)
downloaddotty-8112a39d3a00f53a68af794d0a83cf995faf31e2.tar.gz
dotty-8112a39d3a00f53a68af794d0a83cf995faf31e2.tar.bz2
dotty-8112a39d3a00f53a68af794d0a83cf995faf31e2.zip
Improved printing of flags
(1) Make sure ModifierFlags is TermFlags and TypeFlags (2) Shorten private <local> to private[this]; same with protected (3) Print [this] for local symbols in RefinedPrinter
Diffstat (limited to 'src/dotty/tools/dotc/core/Flags.scala')
-rw-r--r--src/dotty/tools/dotc/core/Flags.scala17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/Flags.scala b/src/dotty/tools/dotc/core/Flags.scala
index 40da7525d..07259276e 100644
--- a/src/dotty/tools/dotc/core/Flags.scala
+++ b/src/dotty/tools/dotc/core/Flags.scala
@@ -102,8 +102,16 @@ object Flags {
}
/** The list of non-empty names of flags that are set in this FlagSet */
- def flagStrings: Seq[String] =
- (2 to MaxFlag).flatMap(flagString)
+ def flagStrings: Seq[String] = {
+ val rawStrings = (2 to MaxFlag).flatMap(flagString)
+ if (this is Local)
+ rawStrings.filter(_ != "<local>").map {
+ case "private" => "private[this]"
+ case "protected" => "protected[this]"
+ case str => str
+ }
+ else rawStrings
+ }
/** The string representation of this flag set */
override def toString = flagStrings.mkString(" ")
@@ -405,7 +413,10 @@ object Flags {
/** Flags representing modifiers that can appear in trees */
final val ModifierFlags =
- SourceModifierFlags | Trait | Module | Param | Synthetic | Package
+ SourceModifierFlags | Module | Param | Synthetic | Package | Local
+ // | Trait is subsumed by commonFlags(Lazy) from SourceModifierFlags
+
+ assert(ModifierFlags.isTermFlags && ModifierFlags.isTypeFlags)
/** Flags representing access rights */
final val AccessFlags = Private | Protected | Local