File tree Expand file tree Collapse file tree 8 files changed +16
-3
lines changed Expand file tree Collapse file tree 8 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 8
8
import Element
9
9
import Location
10
10
11
+ private Location unmapLoc ( Location l ) {
12
+ result .( SourceLocation ) .getMappedLocation ( ) = l
13
+ or
14
+ not exists ( result .( SourceLocation ) .getMappedLocation ( ) ) and
15
+ result = l
16
+ }
17
+
11
18
/**
12
19
* A single line of comment.
13
20
*
@@ -19,7 +26,7 @@ class CommentLine extends @commentline {
19
26
string toString ( ) { none ( ) }
20
27
21
28
/** Gets the location of this comment line. */
22
- Location getLocation ( ) { commentline_location ( this , result ) }
29
+ Location getLocation ( ) { commentline_location ( this , unmapLoc ( result ) ) }
23
30
24
31
/** Gets the containing comment block. */
25
32
CommentBlock getParent ( ) { result .getAChild ( ) = this }
@@ -159,7 +166,7 @@ class CommentBlock extends @commentblock {
159
166
string toString ( ) { result = this .getChild ( 0 ) .toString ( ) }
160
167
161
168
/** Gets the location of this comment block */
162
- Location getLocation ( ) { commentblock_location ( this , result ) }
169
+ Location getLocation ( ) { commentblock_location ( this , unmapLoc ( result ) ) }
163
170
164
171
/** Gets the number of lines in this comment block. */
165
172
int getNumLines ( ) { result = count ( this .getAChild ( ) ) }
Original file line number Diff line number Diff line change 1
1
| comments1.cs:1:1:2:46 | // ... | comments1.cs:9:7:9:7 | C | Start of comment1.cs |
2
+ | comments1.cs:1:16:1:46 | // ... | comments1.cs:2:9:2:14 | ... ...; | A mapped single-line comment |
2
3
| comments1.cs:4:1:4:25 | // ... | comments1.cs:9:7:9:7 | C | 1) Basic comment types |
3
4
| comments1.cs:6:1:6:24 | // ... | comments1.cs:9:7:9:7 | C | A single-line comment |
4
5
| comments1.cs:8:1:8:18 | /// ... | comments1.cs:9:7:9:7 | C | An XML comment |
Original file line number Diff line number Diff line change
1
+ | comments1.cs:1:16:1:46 | // ... | comments1.cs:1:9:1:14 | ... ...; | A mapped single-line comment |
1
2
| comments1.cs:11:1:11:25 | /* ... */ | comments1.cs:9:7:9:7 | C | A multiline comment |
2
3
| comments1.cs:13:1:13:20 | // ... | comments1.cs:9:7:9:7 | C | 2) Comment blocks |
3
4
| comments1.cs:15:1:15:38 | // ... | comments1.cs:9:7:9:7 | C | A line on its own is a commentblock |
Original file line number Diff line number Diff line change
1
+ | comments1.cs:1:16:1:46 | // ... | trivia.cs:17:5:29:5 | {...} | A mapped single-line comment |
1
2
| comments1.cs:36:5:38:41 | /* ... */ | comments1.cs:34:7:34:9 | Foo | |
2
3
| comments1.cs:39:13:40:51 | // ... | comments1.cs:34:7:34:9 | Foo | as this line |
3
4
| comments1.cs:42:15:42:36 | // ... | comments1.cs:34:7:34:9 | Foo | These are different |
Original file line number Diff line number Diff line change
1
+ | comments1.cs:1:16:1:46 | // ... | comments1.cs:1:9:1:14 | ... ...; | A mapped single-line comment |
1
2
| comments1.cs:8:1:8:18 | /// ... | comments1.cs:9:7:9:7 | C | An XML comment |
2
3
| comments1.cs:36:5:38:41 | /* ... */ | comments1.cs:39:9:39:9 | x | |
3
4
| comments1.cs:39:13:40:51 | // ... | comments1.cs:39:9:39:9 | x | as this line |
Original file line number Diff line number Diff line change 1
1
singlelineComment
2
2
| comments1.cs:1:1:2:46 | // ... | comments1.cs:1:1:1:23 | // ... | 2 | Start of comment1.cs | // Start of comment1.cs |
3
3
| comments1.cs:1:1:2:46 | // ... | comments1.cs:2:1:2:46 | // ... | 2 | This tests the basic types of comment block | // This tests the basic types of comment block |
4
+ | comments1.cs:1:16:1:46 | // ... | comments1.cs:1:16:1:46 | // ... | 1 | A mapped single-line comment | // A mapped single-line comment |
4
5
| comments1.cs:4:1:4:25 | // ... | comments1.cs:4:1:4:25 | // ... | 1 | 1) Basic comment types | // 1) Basic comment types |
5
6
| comments1.cs:6:1:6:24 | // ... | comments1.cs:6:1:6:24 | // ... | 1 | A single-line comment | // A single-line comment |
6
7
| comments1.cs:13:1:13:20 | // ... | comments1.cs:13:1:13:20 | // ... | 1 | 2) Comment blocks | // 2) Comment blocks |
Original file line number Diff line number Diff line change 16
16
| trivia.cs:19:9:19:11 | trivia.cs:19:9:19:11 | comments1.cs:1:9:1:11 | comments1.cs:1:9:1:11 |
17
17
| trivia.cs:19:9:19:14 | trivia.cs:19:9:19:14 | comments1.cs:1:9:1:14 | comments1.cs:1:9:1:14 |
18
18
| trivia.cs:19:13:19:13 | trivia.cs:19:13:19:13 | comments1.cs:1:13:1:13 | comments1.cs:1:13:1:13 |
19
+ | trivia.cs:19:16:19:46 | trivia.cs:19:16:19:46 | comments1.cs:1:16:1:46 | comments1.cs:1:16:1:46 |
19
20
| trivia.cs:20:9:20:11 | trivia.cs:20:9:20:11 | comments1.cs:2:9:2:11 | comments1.cs:2:9:2:11 |
20
21
| trivia.cs:20:9:20:14 | trivia.cs:20:9:20:14 | comments1.cs:2:9:2:14 | comments1.cs:2:9:2:14 |
21
22
| trivia.cs:20:13:20:13 | trivia.cs:20:13:20:13 | comments1.cs:2:13:2:13 | comments1.cs:2:13:2:13 |
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ class Tr1
16
16
static void M1 ( )
17
17
{
18
18
#line 1 "comments1.cs"
19
- int i ;
19
+ int i ; // A mapped single-line comment
20
20
int j ;
21
21
#line default
22
22
char c ;
You can’t perform that action at this time.
0 commit comments