diff options
author | Paul Phillips <paulp@improving.org> | 2013-05-11 13:02:54 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-05-11 13:02:54 -0700 |
commit | c663ecf8677eda3fe8c91170b614eb7166b18711 (patch) | |
tree | 80184e648c1f8c72f7e424649552425ceb51b19c /src/compiler/scala/tools/nsc/typechecker/Contexts.scala | |
parent | 433880e91cba9e1e926e9fcbf04ecd4aeb1d73eb (diff) | |
download | scala-c663ecf8677eda3fe8c91170b614eb7166b18711.tar.gz scala-c663ecf8677eda3fe8c91170b614eb7166b18711.tar.bz2 scala-c663ecf8677eda3fe8c91170b614eb7166b18711.zip |
Incorporated reviewer feedback.
Made things a little more consistent and self-apparent.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Contexts.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Contexts.scala | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index fc1db32a2d..21c33aad0d 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -365,6 +365,7 @@ trait Contexts { self: Analyzer => @inline final def withinSuperInit[T](op: => T): T = withMode(enabled = SuperInit)(op) @inline final def withinSecondTry[T](op: => T): T = withMode(enabled = SecondTry)(op) @inline final def withinTypeConstructor[T](op: => T): T = withMode(enabled = TypeConstructor)(op) + @inline final def withinPatAlternative[T](op: => T): T = withMode(enabled = PatternAlternative)(op) /* TODO - consolidate returnsSeen (which seems only to be used by checkDead) * and ReturnExpr. @@ -374,14 +375,8 @@ trait Contexts { self: Analyzer => withMode(enabled = ReturnExpr)(op) } - /** TODO: The "sticky modes" are EXPRmode, PATTERNmode, TYPEmode. - * To mimick the sticky mode behavior, when captain stickyfingers - * comes around we need to propagate those modes but forget the other - * context modes which were once mode bits; those being so far the - * ones listed here. - */ - @inline final def withOnlyStickyModes[T](op: => T): T = - withMode(disabled = PatternAlternative | StarPatterns | SuperInit | SecondTry | ReturnExpr | TypeConstructor | TypeApplication)(op) + // See comment on FormerNonStickyModes. + @inline final def withOnlyStickyModes[T](op: => T): T = withMode(disabled = FormerNonStickyModes)(op) /** @return true if the `expr` evaluates to true within a silent Context that incurs no errors */ @inline final def inSilentMode(expr: => Boolean): Boolean = { @@ -1389,6 +1384,16 @@ object ContextMode { */ final val TypeApplication: ContextMode = 1 << 17 + /** TODO: The "sticky modes" are EXPRmode, PATTERNmode, TYPEmode. + * To mimick the sticky mode behavior, when captain stickyfingers + * comes around we need to propagate those modes but forget the other + * context modes which were once mode bits; those being so far the + * ones listed here. + */ + final val FormerNonStickyModes: ContextMode = ( + PatternAlternative | StarPatterns | SuperInit | SecondTry | ReturnExpr | TypeConstructor | TypeApplication + ) + final val DefaultMode: ContextMode = MacrosEnabled private val contextModeNameMap = Map( |