Skip to content

Commit 179699b

Browse files
committed
merge troubles
1 parent 30323b9 commit 179699b

File tree

4 files changed

+42
-17
lines changed

4 files changed

+42
-17
lines changed

crates/bevy_mod_scripting_core/src/bindings/function/arg_meta.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
use std::{ffi::OsString, path::PathBuf};
44

55
use crate::{
6-
bindings::{ScriptValue, ReflectReference},
7-
docgen::TypedThrough,
6+
bindings::{ReflectReference, ScriptValue},
7+
docgen::TypedThrough, error::InteropError,
88
};
99

1010
use super::{

crates/bevy_mod_scripting_core/src/bindings/function/into.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::{borrow::Cow, collections::HashMap, ffi::OsString, path::PathBuf};
44
use bevy::reflect::Reflect;
55

66
use crate::{bindings::{ReflectReference, ScriptValue, WorldGuard}, error::InteropError};
7-
use super::{DynamicScriptFunction, DynamicScriptFunctionMut, Val};
7+
use super::{DynamicScriptFunction, DynamicScriptFunctionMut, Union, Val};
88

99
/// Converts a value into a [`ScriptValue`].
1010
pub trait IntoScript {

crates/bevy_mod_scripting_core/src/bindings/function/type_dependencies.rs

+38-13
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,35 @@
22
33
use super::{
44
from::{Mut, Ref, Union, Val},
5-
script_function::FunctionCallContext,
5+
script_function::FunctionCallContext, DynamicScriptFunction, DynamicScriptFunctionMut,
66
};
7-
use crate::{
8-
bindings::{ReflectReference, WorldGuard},
9-
error::InteropError, private::{no_type_dependencies, self_type_dependency_only},
10-
};
11-
use crate::{bindings::{ReflectReference, ScriptValue}, error::InteropError};
7+
use crate::
8+
bindings::{ReflectReference, ScriptValue}
9+
;
1210
use bevy::reflect::{FromReflect, GetTypeRegistration, TypeRegistry, Typed};
1311
use bevy_mod_scripting_derive::impl_get_type_dependencies;
1412
use std::{collections::HashMap, ffi::OsString, hash::Hash, path::PathBuf};
1513

16-
/// Functionally identical to [`GetTypeRegistration`] but without the 'static bound
17-
pub trait GetTypeDependencies {
18-
/// In the majority of the implementations, this will be `Self`
19-
/// However some types might be `facades` for other types, in which case this will be the underlying type
20-
type Underlying;
2114

22-
/// Registers the type dependencies of the implementing type with the given [`TypeRegistry`].
23-
fn register_type_dependencies(registry: &mut TypeRegistry);
15+
16+
macro_rules! impl_get_type_dependencies_primitives {
17+
($($ty:ty),*) => {
18+
$(
19+
impl_get_type_dependencies!(
20+
#[derive(GetTypeDependencies)]
21+
#[get_type_dependencies(bms_core_path="crate")]
22+
struct $ty where {}
23+
);
24+
)*
25+
};
2426
}
2527

28+
impl_get_type_dependencies_primitives!(
29+
i8, i16, i32, i64, i128, u8, u16, u32, u64, u128, usize, isize, f32, f64, bool,
30+
ScriptValue, DynamicScriptFunction, DynamicScriptFunctionMut,
31+
String, PathBuf, OsString, char
32+
);
33+
2634

2735
impl GetTypeDependencies for () {
2836
type Underlying = ();
@@ -31,6 +39,23 @@ impl GetTypeDependencies for () {
3139
}
3240
}
3341

42+
impl GetTypeDependencies for &'static str {
43+
type Underlying = &'static str;
44+
fn register_type_dependencies(registry: &mut TypeRegistry) {
45+
registry.register::<&'static str>();
46+
}
47+
}
48+
49+
/// Functionally identical to [`GetTypeRegistration`] but without the 'static bound
50+
pub trait GetTypeDependencies {
51+
/// In the majority of the implementations, this will be `Self`
52+
/// However some types might be `facades` for other types, in which case this will be the underlying type
53+
type Underlying;
54+
55+
/// Registers the type dependencies of the implementing type with the given [`TypeRegistry`].
56+
fn register_type_dependencies(registry: &mut TypeRegistry);
57+
}
58+
3459
impl_get_type_dependencies!(
3560
#[derive(GetTypeDependencies)]
3661
#[get_type_dependencies(bms_core_path="crate")]

crates/bevy_mod_scripting_core/src/bindings/world.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use super::{
1212
}, function::{
1313
namespace::Namespace,
1414
script_function::{AppScriptFunctionRegistry, DynamicScriptFunction, FunctionCallContext},
15-
}, pretty_print::DisplayWithWorld, schedule::AppScheduleRegistry, script_value::ScriptValue, with_global_access, AppReflectAllocator, ReflectBase, ReflectBaseType, ReflectReference, ScriptComponentRegistration, ScriptResourceRegistration, ScriptTypeRegistration
15+
}, pretty_print::DisplayWithWorld, schedule::AppScheduleRegistry, script_value::ScriptValue, with_global_access, AppReflectAllocator, ReflectBase, ReflectBaseType, ReflectReference, ScriptComponentRegistration, ScriptResourceRegistration, ScriptTypeRegistration, Union
1616
};
1717
use crate::{
1818
bindings::{function::{from::FromScript, from_ref::FromScriptRef}, with_access_read, with_access_write},

0 commit comments

Comments
 (0)