Skip to content

Commit 528072e

Browse files
committed
tighten codegen ordering
1 parent bc6beb2 commit 528072e

File tree

4 files changed

+715
-703
lines changed

4 files changed

+715
-703
lines changed

crates/bevy_api_gen/src/passes/populate_template_data.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,19 @@ pub(crate) fn populate_template_data(ctxt: &mut BevyCtxt<'_>, args: &Args) -> bo
3232
let has_static_methods = fn_ctxts.iter().any(|fn_ctxt| !fn_ctxt.has_self);
3333

3434
let mut functions = process_functions(ctxt, fn_ctxts);
35-
functions.sort_by(|a, b| a.ident.cmp(&b.ident));
35+
functions.sort_by(|a, b| {
36+
a.ident
37+
.cmp(&b.ident)
38+
.then(a.args.len().cmp(&b.args.len()))
39+
.then(
40+
a.args
41+
.iter()
42+
.zip(b.args.iter())
43+
.fold(std::cmp::Ordering::Equal, |acc, (a, b)| {
44+
acc.then(a.ty.cmp(&b.ty))
45+
}),
46+
)
47+
});
3648

3749
let variant = ty_ctxt.variant_data.as_ref().unwrap();
3850

crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -212,22 +212,22 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin {
212212
)
213213
.register(
214214
"mul",
215-
|
216-
_self: Val<bevy::math::Isometry2d>,
217-
rhs: Val<bevy::math::prelude::Dir2>|
218-
{
219-
let output: Val<bevy::math::prelude::Dir2> = <bevy::math::Isometry2d as std::ops::Mul<
220-
bevy::math::prelude::Dir2,
215+
|_self: Val<bevy::math::Isometry2d>, rhs: Val<bevy::math::Isometry2d>| {
216+
let output: Val<bevy::math::Isometry2d> = <bevy::math::Isometry2d as std::ops::Mul<
217+
bevy::math::Isometry2d,
221218
>>::mul(_self.into_inner(), rhs.into_inner())
222219
.into();
223220
output
224221
},
225222
)
226223
.register(
227224
"mul",
228-
|_self: Val<bevy::math::Isometry2d>, rhs: Val<bevy::math::Isometry2d>| {
229-
let output: Val<bevy::math::Isometry2d> = <bevy::math::Isometry2d as std::ops::Mul<
230-
bevy::math::Isometry2d,
225+
|
226+
_self: Val<bevy::math::Isometry2d>,
227+
rhs: Val<bevy::math::prelude::Dir2>|
228+
{
229+
let output: Val<bevy::math::prelude::Dir2> = <bevy::math::Isometry2d as std::ops::Mul<
230+
bevy::math::prelude::Dir2,
231231
>>::mul(_self.into_inner(), rhs.into_inner())
232232
.into();
233233
output
@@ -524,6 +524,16 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin {
524524
output
525525
},
526526
)
527+
.register(
528+
"mul",
529+
|_self: Val<bevy::math::Rot2>, rhs: Val<bevy::math::Rot2>| {
530+
let output: Val<bevy::math::Rot2> = <bevy::math::Rot2 as std::ops::Mul<
531+
bevy::math::Rot2,
532+
>>::mul(_self.into_inner(), rhs.into_inner())
533+
.into();
534+
output
535+
},
536+
)
527537
.register(
528538
"mul",
529539
|
@@ -537,16 +547,6 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin {
537547
output
538548
},
539549
)
540-
.register(
541-
"mul",
542-
|_self: Val<bevy::math::Rot2>, rhs: Val<bevy::math::Rot2>| {
543-
let output: Val<bevy::math::Rot2> = <bevy::math::Rot2 as std::ops::Mul<
544-
bevy::math::Rot2,
545-
>>::mul(_self.into_inner(), rhs.into_inner())
546-
.into();
547-
output
548-
},
549-
)
550550
.register(
551551
"nlerp",
552552
|_self: Val<bevy::math::Rot2>, end: Val<bevy::math::Rot2>, s: f32| {

0 commit comments

Comments
 (0)