Commit 5fee131
committed
Fix #5482: Empty buffer when not parsing comments
The scanner keeps a buffer `commentBuf` which contains the content of
the comment being parsed. When encountering a `/`, we check whether this
is the beginning of a comment. Checking this adds the slash to the
buffer. If this wasn't a comment, the buffer wasn't emptied, and the
slash would still be there and would be prepended to the next comment.
This commit fixes this by emptying the buffer when we detect that the
slash wasn't the start of a comment.
Fixes #54821 parent d6e67d4 commit 5fee131
File tree
2 files changed
+13
-1
lines changed- compiler/src/dotty/tools/dotc/parsing
- language-server/test/dotty/tools/languageserver
2 files changed
+13
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
631 | 631 | | |
632 | 632 | | |
633 | 633 | | |
634 | | - | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
635 | 639 | | |
636 | 640 | | |
637 | 641 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| 167 | + | |
167 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
168 | 176 | | |
169 | 177 | | |
0 commit comments