File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
godot-macros/src/class/data_models Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change 4
4
* License, v. 2.0. If a copy of the MPL was not distributed with this
5
5
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
6
6
*/
7
+
7
8
use crate :: class:: Field ;
8
9
use crate :: util:: bail;
9
10
use crate :: ParseResult ;
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ pub(crate) struct ExportGroupOrdering {
60
60
61
61
impl ExportGroupOrdering {
62
62
/// Creates root which holds all the groups&subgroups.
63
+ /// Should be called only once in a given context.
63
64
fn root ( ) -> Self {
64
65
Self {
65
66
identifier : None ,
@@ -96,7 +97,7 @@ enum OrderingStage {
96
97
SubGroup ,
97
98
}
98
99
99
- // It is recursive but max recursion depth is 1 so it's fine.
100
+ // It is recursive but max recursion depth is 2 (root -> group -> subgroup) so it's fine.
100
101
fn compare_by_group_and_declaration_order (
101
102
field_a : & FieldGroup ,
102
103
field_b : & FieldGroup ,
@@ -172,7 +173,7 @@ pub(crate) fn sort_fields_by_group(fields: &mut Fields) {
172
173
173
174
// `sort_by` instead of `sort_unstable_by` to preserve original order of declaration.
174
175
// Which is not guaranteed by the way albeit worked reliably so far.
175
- fields. all_fields . sort_unstable_by ( |a, b| {
176
+ fields. all_fields . sort_by ( |a, b| {
176
177
let ( group_a, group_b) = match ( & a. group , & b. group ) {
177
178
( Some ( a) , Some ( b) ) => ( a, b) ,
178
179
( Some ( _) , None ) => return Ordering :: Greater ,
You can’t perform that action at this time.
0 commit comments