File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -986,8 +986,10 @@ impl TypedAstContext {
986986 }
987987 }
988988
989- pub fn sort_top_decls ( & mut self ) {
990- // Group and sort declarations by file and by position
989+ /// Sort the top-level declarations by file and source location
990+ /// so that we preserve the ordering of all declarations in each file.
991+ /// This preserves the order when we emit the converted declarations.
992+ pub fn sort_top_decls_for_emitting ( & mut self ) {
991993 let mut decls_top = mem:: take ( & mut self . c_decls_top ) ;
992994 decls_top. sort_unstable_by ( |a, b| {
993995 let a = self . index ( * a) ;
Original file line number Diff line number Diff line change @@ -738,9 +738,7 @@ pub fn translate(
738738 } )
739739 . collect :: < HashMap < _ , _ > > ( ) ;
740740
741- // Sort the top-level declarations by file and source location so that we
742- // preserve the ordering of all declarations in each file.
743- t. ast_context . sort_top_decls ( ) ;
741+ t. ast_context . sort_top_decls_for_emitting ( ) ;
744742
745743 for top_id in & t. ast_context . c_decls_top {
746744 let decl = t. ast_context . get_decl ( top_id) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments