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 @@ -973,8 +973,10 @@ impl TypedAstContext {
973973 }
974974 }
975975
976- pub fn sort_top_decls ( & mut self ) {
977- // Group and sort declarations by file and by position
976+ /// Sort the top-level declarations by file and source location
977+ /// so that we preserve the ordering of all declarations in each file.
978+ /// This preserves the order when we emit the converted declarations.
979+ pub fn sort_top_decls_for_emitting ( & mut self ) {
978980 let mut decls_top = mem:: take ( & mut self . c_decls_top ) ;
979981 decls_top. sort_unstable_by ( |a, b| {
980982 let a = self . index ( * a) ;
Original file line number Diff line number Diff line change @@ -737,9 +737,7 @@ pub fn translate(
737737 } )
738738 . collect :: < HashMap < _ , _ > > ( ) ;
739739
740- // Sort the top-level declarations by file and source location so that we
741- // preserve the ordering of all declarations in each file.
742- t. ast_context . sort_top_decls ( ) ;
740+ t. ast_context . sort_top_decls_for_emitting ( ) ;
743741
744742 for top_id in & t. ast_context . c_decls_top {
745743 let decl = t. ast_context . get_decl ( top_id) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments