Translate Types and Utilities parity tests
Some checks failed
Rust API gates / api-gates (push) Has been cancelled
Some checks failed
Rust API gates / api-gates (push) Has been cancelled
This commit is contained in:
@@ -170,6 +170,12 @@ SUPPORT_TYPES = {
|
||||
MEMBER_RETURN_OVERRIDES = {
|
||||
"M:LibreMetaverse.Caps.Capabilities": "Vec<String>",
|
||||
}
|
||||
TYPE_USAGE_OVERRIDES = {
|
||||
"LibreMetaverse.DictionaryChangeCallback": (
|
||||
"std::sync::Arc<dyn Fn(libremetaverse::DictionaryEventAction, "
|
||||
"libremetaverse_types::compat::DictionaryEntry) + Send + Sync>"
|
||||
),
|
||||
}
|
||||
TYPE_NAME_OVERRIDES = {
|
||||
"T:LibreMetaverse.LslTools.Error": "LslError",
|
||||
}
|
||||
@@ -337,7 +343,7 @@ def external_type_target(item: dict) -> tuple[str, str, str, str]:
|
||||
output = arguments[-1] if arguments else "()"
|
||||
return "core", "callback", f"Box<dyn Fn({', '.join(arguments[:-1])}) -> {output} + Send + Sync>", "language"
|
||||
if base == "System.EventHandler":
|
||||
return "libremetaverse-types", "compat", f"libremetaverse_types::compat::EventHandler<{arguments[-1] if arguments else '()'}>", "native_cross_platform_replacement"
|
||||
return "std", "sync", f"std::sync::Arc<dyn Fn({arguments[-1] if arguments else '()'}) + Send + Sync>", "stdlib_or_adopted_crate"
|
||||
if base in {"System.Tuple", "System.ValueTuple"}:
|
||||
return "core", "tuple", "(" + ", ".join(arguments) + ("," if len(arguments) == 1 else "") + ")", "language"
|
||||
if base == "System.Nullable" and arguments:
|
||||
@@ -502,7 +508,7 @@ class Mapper:
|
||||
parameters = ", ".join(mapped_arguments[:-1])
|
||||
target = f"Box<dyn Fn({parameters}) -> {output} + Send + Sync>"
|
||||
elif base == "System.EventHandler":
|
||||
target = f"libremetaverse_types::compat::EventHandler<{mapped_arguments[-1] if mapped_arguments else '()'}>"
|
||||
target = f"std::sync::Arc<dyn Fn({mapped_arguments[-1] if mapped_arguments else '()'}) + Send + Sync>"
|
||||
elif base in {"System.Tuple", "System.ValueTuple"}:
|
||||
target = "(" + ", ".join(mapped_arguments) + ("," if len(mapped_arguments) == 1 else "") + ")"
|
||||
elif base == "System.Nullable" and mapped_arguments:
|
||||
@@ -514,7 +520,7 @@ class Mapper:
|
||||
if base in generics or ("." not in base and base.startswith("T")):
|
||||
target = base
|
||||
elif target is None:
|
||||
target = self.resolved.get(base)
|
||||
target = TYPE_USAGE_OVERRIDES.get(base, self.resolved.get(base))
|
||||
if target is None:
|
||||
raise ValueError(f"unresolved referenced type: {value} (base {base})")
|
||||
if mapped_arguments and base not in {
|
||||
|
||||
Reference in New Issue
Block a user