File tree 1 file changed +11
-12
lines changed
1 file changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,10 @@ function clampPosition (pos) {
40
40
}
41
41
}
42
42
43
+ function discardPosition ( pos ) {
44
+ return ! pos || ! pos . source || pos . line === null || pos . column === null
45
+ }
46
+
43
47
// Maps the coverage location based on the source map. Adapted from getMapping()
44
48
// in remap-istanbul:
45
49
// <https://github.com/SitePen/remap-istanbul/blob/30b67ad3f24ba7e0da8b8888d5a7c3c8480d48b2/lib/remap.js#L55:L108>.
@@ -51,18 +55,7 @@ function mapLocation (sourceMap, location) {
51
55
var end = sourceMap . originalPositionFor ( clampedEnd )
52
56
53
57
/* istanbul ignore if: edge case too hard to test for */
54
- if ( ! start || ! end ) {
55
- return null
56
- }
57
- if ( ! start . source || ! end . source || start . source !== end . source ) {
58
- return null
59
- }
60
- /* istanbul ignore if: edge case too hard to test for */
61
- if ( start . line === null || start . column === null ) {
62
- return null
63
- }
64
- /* istanbul ignore if: edge case too hard to test for */
65
- if ( end . line === null || end . column === null ) {
58
+ if ( discardPosition ( start ) || discardPosition ( end ) || start . source !== end . source ) {
66
59
return null
67
60
}
68
61
@@ -72,6 +65,12 @@ function mapLocation (sourceMap, location) {
72
65
column : clampedEnd . column ,
73
66
bias : 2
74
67
} )
68
+
69
+ /* istanbul ignore if: edge case too hard to test for */
70
+ if ( discardPosition ( end ) ) {
71
+ return null
72
+ }
73
+
75
74
end . column = end . column - 1
76
75
}
77
76
You can’t perform that action at this time.
0 commit comments