File tree Expand file tree Collapse file tree 2 files changed +23
-18
lines changed Expand file tree Collapse file tree 2 files changed +23
-18
lines changed Original file line number Diff line number Diff line change @@ -1033,14 +1033,17 @@ exports.Lexer = class Lexer
1033
1033
# Compensate for the things we strip out initially (e.g. carriage returns)
1034
1034
# so that location data stays accurate with respect to the original source file.
1035
1035
getLocationDataCompensation : (start , end ) ->
1036
- compensation = 0
1036
+ totalCompensation = 0
1037
1037
initialEnd = end
1038
- for index, length of @locationDataCompensations
1039
- index = parseInt index, 10
1040
- continue unless start <= index and (index < end or index is end and start is initialEnd)
1041
- compensation += length
1042
- end += length
1043
- compensation
1038
+ current = start
1039
+ while current <= end
1040
+ break if current is end and start isnt initialEnd
1041
+ compensation = @locationDataCompensations [current]
1042
+ if compensation?
1043
+ totalCompensation += compensation
1044
+ end += compensation
1045
+ current++
1046
+ return totalCompensation
1044
1047
1045
1048
# Returns the line and column number from an offset into the current chunk.
1046
1049
#
You can’t perform that action at this time.
0 commit comments