diff options
author | Den Shabalin <den.shabalin@gmail.com> | 2013-10-01 16:47:20 +0200 |
---|---|---|
committer | Den Shabalin <den.shabalin@gmail.com> | 2013-10-18 17:24:51 +0200 |
commit | 0fd119d527dbe75b841b47e868bfcc09990714f0 (patch) | |
tree | f145b8532f504bb41e6a8dbb961003c5dc99d7ce /src | |
parent | 9aa5a27042abae1e0ed585863678bc3a6fcf63a4 (diff) | |
download | scala-0fd119d527dbe75b841b47e868bfcc09990714f0.tar.gz scala-0fd119d527dbe75b841b47e868bfcc09990714f0.tar.bz2 scala-0fd119d527dbe75b841b47e868bfcc09990714f0.zip |
better name for isCaseDefStart
As it was pointed out by @paulp current isCaseDefStart method's name
doesn't really correspond to one of it's primary usages: checking if
the block within case has reached it's end.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 12 | ||||
-rw-r--r-- | src/compiler/scala/tools/reflect/quasiquotes/Parsers.scala | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index 508453d5b2..032c0c34b3 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -635,8 +635,6 @@ self => def isAnnotation: Boolean = in.token == AT - def isCaseDefStart: Boolean = in.token == CASE - def isLocalModifier: Boolean = in.token match { case ABSTRACT | FINAL | SEALED | IMPLICIT | LAZY => true case _ => false @@ -687,6 +685,8 @@ self => def isStatSeqEnd = in.token == RBRACE || in.token == EOF + def isCaseDefEnd = in.token == RBRACE || in.token == CASE + def isStatSep(token: Int): Boolean = token == NEWLINE || token == NEWLINES || token == SEMI @@ -1329,7 +1329,7 @@ self => in.nextToken() if (in.token != LBRACE) catchFromExpr() else inBracesOrNil { - if (isCaseDefStart) caseClauses() + if (in.token == CASE) caseClauses() else catchFromExpr() } } @@ -1640,7 +1640,7 @@ self => */ def blockExpr(): Tree = atPos(in.offset) { inBraces { - if (isCaseDefStart) Match(EmptyTree, caseClauses()) + if (in.token == CASE) Match(EmptyTree, caseClauses()) else block() } } @@ -3057,14 +3057,14 @@ self => */ def blockStatSeq(): List[Tree] = checkNoEscapingPlaceholders { val stats = new ListBuffer[Tree] - while (!isStatSeqEnd && !isCaseDefStart) { + while (!isStatSeqEnd && !isCaseDefEnd) { if (in.token == IMPORT) { stats ++= importClause() acceptStatSepOpt() } else if (isExprIntro) { stats += statement(InBlock) - if (in.token != RBRACE && !isCaseDefStart) acceptStatSep() + if (!isCaseDefEnd) acceptStatSep() } else if (isDefIntro || isLocalModifier || isAnnotation) { if (in.token == IMPLICIT) { diff --git a/src/compiler/scala/tools/reflect/quasiquotes/Parsers.scala b/src/compiler/scala/tools/reflect/quasiquotes/Parsers.scala index ae610098dd..bd85aa9cdc 100644 --- a/src/compiler/scala/tools/reflect/quasiquotes/Parsers.scala +++ b/src/compiler/scala/tools/reflect/quasiquotes/Parsers.scala @@ -101,7 +101,7 @@ trait Parsers { self: Quasiquotes => override def isAnnotation: Boolean = super.isAnnotation || (isHole && lookingAhead { isAnnotation }) - override def isCaseDefStart: Boolean = super.isCaseDefStart || (in.token == EOF) + override def isCaseDefEnd: Boolean = super.isCaseDefEnd || (in.token == EOF) override def isModifier: Boolean = super.isModifier || (isHole && lookingAhead { isModifier }) |