mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
6e95f297ea
# Objective Functions created into `DynamicFunction[Mut]` do not currently validate the number of arguments they are given before calling the function. I originally did this because I felt users would want to validate this themselves in the function rather than have it be done behind-the-scenes. I'm now realizing, however, that we could remove this boilerplate and if users wanted to check again then they would still be free to do so (it'd be more of a sanity check at that point). ## Solution Automatically validate the number of arguments passed to `DynamicFunction::call` and `DynamicFunctionMut::call[_once]`. This is a pretty trivial change since we just need to compare the length of the `ArgList` to the length of the `[ArgInfo]` in the function's `FunctionInfo`. I also ran the benchmarks just in case and saw no regression by doing this. ## Testing You can test locally by running: ``` cargo test --package bevy_reflect --all-features ``` |
||
---|---|---|
.. | ||
custom_attributes.rs | ||
dynamic_types.rs | ||
function_reflection.rs | ||
generic_reflection.rs | ||
reflection.rs | ||
reflection_types.rs | ||
type_data.rs |