File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -178,7 +178,20 @@ function trim_parentheses(s: string): string {
178
178
return s ;
179
179
}
180
180
181
- function comments ( cur , options : Options ) : Doc [ ] {
181
+ interface Position {
182
+ pos_fname : string ;
183
+ pos_cnum : number ;
184
+ pos_lnum : number ;
185
+ pos_bol : number ;
186
+ }
187
+
188
+ interface Location {
189
+ loc_start : Position ;
190
+ loc_ghost : boolean ;
191
+ loc_end : Position ;
192
+ }
193
+
194
+ function comments ( cur : Location , options : Options ) : Doc [ ] {
182
195
if ( cur && cur . loc_start . pos_cnum >= 0 ) {
183
196
const last = options . last_loc ;
184
197
if ( last ) {
@@ -203,8 +216,8 @@ function comments(cur, options: Options): Doc[] {
203
216
return [ ] ;
204
217
}
205
218
206
- function gobble_line_comment ( pos , options : Options ) : Doc [ ] {
207
- let i = pos . loc_end . pos_cnum ;
219
+ function gobble_line_comment ( loc : Location , options : Options ) : Doc [ ] {
220
+ let i = loc . loc_end . pos_cnum ;
208
221
const src = options . originalText as string ;
209
222
let comment_from = undefined ;
210
223
while ( src [ i ] != '\n' && i < src . length - 1 ) {
@@ -228,8 +241,8 @@ function gobble_line_comment(pos, options: Options): Doc[] {
228
241
tmp += src [ i ] + src [ i + 1 ] ;
229
242
r . push ( tmp ) ;
230
243
tmp = "" ;
231
- options . last_loc = pos ;
232
- options . last_loc . loc_end . pos_cnum = i ;
244
+ options . last_loc = loc ;
245
+ ( options . last_loc as Location ) . loc_end . pos_cnum = i ;
233
246
}
234
247
else
235
248
i ++ ;
You can’t perform that action at this time.
0 commit comments