Skip to content

Commit 19c5ff5

Browse files
committed
Change tests to be based on JUnit, rename comments variable
1 parent 4f7c4af commit 19c5ff5

File tree

3 files changed

+463
-515
lines changed

3 files changed

+463
-515
lines changed

src/dotty/tools/dotc/parsing/Scanners.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,19 +182,19 @@ object Scanners {
182182
*/
183183
var revComments: List[Comment] = Nil
184184

185-
/** The currently closest docstring, replaced every time a new docstring is
186-
* encountered
185+
/** All doc comments as encountered, each list contains doc comments from
186+
* the same block level. Starting with the deepest level and going upward
187187
*/
188-
var closestDocString: List[List[Comment]] = List(List())
188+
var docsPerBlockStack: List[List[Comment]] = List(List())
189189

190190
/** Adds level of nesting to docstrings */
191191
def enterBlock(): Unit =
192-
closestDocString = Nil ::: closestDocString
192+
docsPerBlockStack = Nil ::: docsPerBlockStack
193193

194194
/** Removes level of nesting for docstrings */
195-
def exitBlock(): Unit = closestDocString = closestDocString match {
195+
def exitBlock(): Unit = docsPerBlockStack = docsPerBlockStack match {
196196
case x :: xs => List(List())
197-
case _ => closestDocString.tail
197+
case _ => docsPerBlockStack.tail
198198
}
199199

200200
/** Returns the closest docstring preceding the position supplied */
@@ -204,10 +204,10 @@ object Scanners {
204204
case Nil => c
205205
}
206206

207-
closestDocString match {
207+
docsPerBlockStack match {
208208
case (list @ (x :: xs)) :: _ => {
209209
val c = closest(x, xs)
210-
closestDocString = list.dropWhile(_ != c).tail :: closestDocString.tail
210+
docsPerBlockStack = list.dropWhile(_ != c).tail :: docsPerBlockStack.tail
211211
Some(c.chrs)
212212
}
213213
case _ => None
@@ -591,7 +591,7 @@ object Scanners {
591591
val comment = Comment(pos, flushBuf(commentBuf))
592592

593593
if (comment.isDocComment)
594-
closestDocString = (closestDocString.head :+ comment) :: closestDocString.tail
594+
docsPerBlockStack = (docsPerBlockStack.head :+ comment) :: docsPerBlockStack.tail
595595

596596
if (keepComments)
597597
revComments = comment :: revComments

0 commit comments

Comments
 (0)