File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -498,8 +498,11 @@ impl<'a> Iterator for TreeIterator<'a> {
498498 fn next ( & mut self ) -> Option < Self :: Item > {
499499 if let Some ( node) = self . nodes_to_visit . pop ( ) {
500500 // Add all children to the queue for processing
501- self . nodes_to_visit
502- . extend ( ( 0 ..node. child_count ( ) ) . rev ( ) . filter_map ( |i| node. child ( i) ) ) ;
501+ let children: Vec < _ > = ( 0 ..node. child_count ( ) )
502+ . rev ( )
503+ . filter_map ( |i| node. child ( i) )
504+ . collect ( ) ;
505+ self . nodes_to_visit . extend ( children) ;
503506 Some ( node)
504507 } else {
505508 None
@@ -523,7 +526,7 @@ fn syntax_errors_from_tree<'a>(
523526 . map ( move |node| {
524527 let start_pos = node. start_position ( ) ;
525528 let end_pos = node. end_position ( ) ;
526- let text = & source[ node. byte_range ( ) ] ;
529+ let text = & source. get ( node. byte_range ( ) ) . unwrap_or ( "" ) ;
527530 SyntaxError {
528531 start_pos,
529532 end_pos,
You can’t perform that action at this time.
0 commit comments