Skip to content

Commit 5fbb49d

Browse files
committed
Document why docstringMap is useful
1 parent b2a66ac commit 5fbb49d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,12 @@ object Scanners {
178178
error(s"illegal combination of -rewrite targets: ${enabled(0).name} and ${enabled(1).name}")
179179
}
180180

181-
/** All doc comments kept by their end position in a `Map` */
181+
/** All doc comments kept by their end position in a `Map`.
182+
*
183+
* Note: the map is necessary since the comments are looked up after an
184+
* entire definition is parsed, and a definition can contain nested
185+
* definitions with their own docstrings.
186+
*/
182187
private var docstringMap: SortedMap[Int, Comment] = SortedMap.empty
183188

184189
/* A Buffer for comment positions */

0 commit comments

Comments
 (0)