diff options
author | Martin Odersky <odersky@gmail.com> | 2015-09-21 22:14:36 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-10-01 19:33:25 +0200 |
commit | 3604a738654effc20be1d31b0e7af3d0847114b4 (patch) | |
tree | 1535a9ee7d2bb23fab69bb3ec6730cc66c32131a /src/dotty/tools/dotc/core/Contexts.scala | |
parent | fe714ed2b6aaca41f1e6681b217022b301f3049d (diff) | |
download | dotty-3604a738654effc20be1d31b0e7af3d0847114b4.tar.gz dotty-3604a738654effc20be1d31b0e7af3d0847114b4.tar.bz2 dotty-3604a738654effc20be1d31b0e7af3d0847114b4.zip |
Replace withMode by addMode
withMode sets the whole mode, nit an individual bits. This was used
wrongly in several places. Make this less of a trap by renaming
withMode -> withModeBits.
Diffstat (limited to 'src/dotty/tools/dotc/core/Contexts.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Contexts.scala | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala index 206ef9d8b..f9d64b2cc 100644 --- a/src/dotty/tools/dotc/core/Contexts.scala +++ b/src/dotty/tools/dotc/core/Contexts.scala @@ -439,12 +439,12 @@ object Contexts { } implicit class ModeChanges(val c: Context) extends AnyVal { - final def withMode(mode: Mode): Context = + final def withModeBits(mode: Mode): Context = if (mode != c.mode) c.fresh.setMode(mode) else c - final def addMode(mode: Mode): Context = withMode(c.mode | mode) - final def maskMode(mode: Mode): Context = withMode(c.mode & mode) - final def retractMode(mode: Mode): Context = withMode(c.mode &~ mode) + final def addMode(mode: Mode): Context = withModeBits(c.mode | mode) + final def maskMode(mode: Mode): Context = withModeBits(c.mode & mode) + final def retractMode(mode: Mode): Context = withModeBits(c.mode &~ mode) } implicit class FreshModeChanges(val c: FreshContext) extends AnyVal { |