Skip to content

Commit 74911e5

Browse files
committed
dummy validate_param
1 parent b884f96 commit 74911e5

File tree

8 files changed

+388
-13
lines changed

8 files changed

+388
-13
lines changed

crates/bevy_ecs/macros/src/lib.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,16 @@ pub fn impl_param_set(_input: TokenStream) -> TokenStream {
271271
<(#(#param,)*) as SystemParam>::apply(state, system_meta, world);
272272
}
273273

274+
#[inline]
275+
fn validate_param<'w, 's>(
276+
state: &'s Self::State,
277+
system_meta: &SystemMeta,
278+
world: &World,
279+
change_tick: Tick,
280+
) -> bool {
281+
<(#(#param,)*) as SystemParam>::validate_param(state, system_meta, world, change_tick)
282+
}
283+
274284
#[inline]
275285
unsafe fn get_param<'w, 's>(
276286
state: &'s mut Self::State,
@@ -512,6 +522,17 @@ pub fn derive_system_param(input: TokenStream) -> TokenStream {
512522
<#fields_alias::<'_, '_, #punctuated_generic_idents> as #path::system::SystemParam>::queue(&mut state.state, system_meta, world);
513523
}
514524

525+
#[inline]
526+
fn validate_param<'w, 's>(
527+
state: &'s Self::State,
528+
system_meta: &#path::system::SystemMeta,
529+
world: &#path::world::World,
530+
change_tick: #path::component::Tick,
531+
) -> bool {
532+
<(#(#tuple_types,)*) as #path::system::SystemParam>::validate_param(&state.state, system_meta, world, change_tick)
533+
}
534+
535+
#[inline]
515536
unsafe fn get_param<'w, 's>(
516537
state: &'s mut Self::State,
517538
system_meta: &#path::system::SystemMeta,

crates/bevy_ecs/src/removal_detection.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,16 @@ unsafe impl<'a> SystemParam for &'a RemovedComponentEvents {
258258

259259
fn init_state(_world: &mut World, _system_meta: &mut SystemMeta) -> Self::State {}
260260

261+
#[inline]
262+
fn validate_param<'w, 's>(
263+
_state: &'s Self::State,
264+
_system_meta: &SystemMeta,
265+
_world: &World,
266+
_change_tick: Tick,
267+
) -> bool {
268+
true
269+
}
270+
261271
#[inline]
262272
unsafe fn get_param<'w, 's>(
263273
_state: &'s mut Self::State,

crates/bevy_ecs/src/system/commands/mod.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ const _: () = {
9191
// SAFETY: Only reads Entities
9292
unsafe impl bevy_ecs::system::SystemParam for Commands<'_, '_> {
9393
type State = FetchState;
94+
9495
type Item<'w, 's> = Commands<'w, 's>;
96+
9597
fn init_state(
9698
world: &mut World,
9799
system_meta: &mut bevy_ecs::system::SystemMeta,
@@ -103,6 +105,7 @@ const _: () = {
103105
),
104106
}
105107
}
108+
106109
unsafe fn new_archetype(
107110
state: &mut Self::State,
108111
archetype: &bevy_ecs::archetype::Archetype,
@@ -117,6 +120,7 @@ const _: () = {
117120
);
118121
};
119122
}
123+
120124
fn apply(
121125
state: &mut Self::State,
122126
system_meta: &bevy_ecs::system::SystemMeta,
@@ -128,6 +132,7 @@ const _: () = {
128132
world,
129133
);
130134
}
135+
131136
fn queue(
132137
state: &mut Self::State,
133138
system_meta: &bevy_ecs::system::SystemMeta,
@@ -139,13 +144,25 @@ const _: () = {
139144
world,
140145
);
141146
}
147+
148+
#[inline]
149+
fn validate_param<'w, 's>(
150+
state: &'s Self::State,
151+
system_meta: &bevy_ecs::system::SystemMeta,
152+
world: &World,
153+
change_tick: bevy_ecs::component::Tick,
154+
) -> bool {
155+
<(Deferred<'s, CommandQueue>, &'w Entities) as bevy_ecs::system::SystemParam>::validate_param(&state.state, system_meta, world, change_tick)
156+
}
157+
158+
#[inline]
142159
unsafe fn get_param<'w, 's>(
143160
state: &'s mut Self::State,
144161
system_meta: &bevy_ecs::system::SystemMeta,
145162
world: bevy_ecs::world::unsafe_world_cell::UnsafeWorldCell<'w>,
146163
change_tick: bevy_ecs::component::Tick,
147164
) -> Self::Item<'w, 's> {
148-
let(f0,f1,) = <(Deferred<'s,CommandQueue> , &'w Entities,)as bevy_ecs::system::SystemParam> ::get_param(&mut state.state,system_meta,world,change_tick);
165+
let(f0, f1) = <(Deferred<'s, CommandQueue>, &'w Entities) as bevy_ecs::system::SystemParam>::get_param(&mut state.state, system_meta, world, change_tick);
149166
Commands {
150167
queue: InternalQueue::CommandQueue(f0),
151168
entities: f1,

crates/bevy_ecs/src/system/system_name.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@ unsafe impl SystemParam for SystemName<'_> {
7676
system_meta.name.clone()
7777
}
7878

79+
#[inline]
80+
fn validate_param<'w, 's>(
81+
_state: &'s Self::State,
82+
_system_meta: &SystemMeta,
83+
_world: &World,
84+
_change_tick: Tick,
85+
) -> bool {
86+
true
87+
}
88+
7989
#[inline]
8090
unsafe fn get_param<'w, 's>(
8191
name: &'s mut Self::State,

0 commit comments

Comments
 (0)