Publish native arity and validate callback contracts before registration
Verify Tessera GUI / verify (push) Failing after 7m44s

This commit is contained in:
2026-10-22 12:03:24 +08:00
parent 50422f801a
commit 25275b515c
17 changed files with 297 additions and 35 deletions
+21
View File
@@ -71,6 +71,19 @@ struct Method {
}
impl NativeCallable for Method {
fn arity(&self) -> Option<endor_core::CallArity> {
Some(endor_core::CallArity::exact(
if matches!(
self.query,
Query::HitTest | Query::ScrollTo | Query::ScrollBy
) {
2
} else {
0
},
))
}
fn invoke(&self, cx: &mut NativeContext<'_>, args: &[Value]) -> Result<NativeResult, VmError> {
let mount = cx.store().payload::<Mount>(self.owner, "Mount")?.clone();
if !mount.mounted
@@ -246,6 +259,10 @@ struct LifecycleCall {
mount: ObjectRef,
}
impl NativeCallable for LifecycleCall {
fn arity(&self) -> Option<endor_core::CallArity> {
Some(endor_core::CallArity::exact(0))
}
fn invoke(&self, _: &mut NativeContext<'_>, _: &[Value]) -> Result<NativeResult, VmError> {
Ok(NativeResult::Invoke {
function: self.function,
@@ -280,6 +297,10 @@ fn lifecycle_call(
}
impl NativeCallable for Sync {
fn arity(&self) -> Option<endor_core::CallArity> {
Some(endor_core::CallArity::exact(0))
}
fn invoke(&self, cx: &mut NativeContext<'_>, _args: &[Value]) -> Result<NativeResult, VmError> {
let mut blocks = HashMap::new();
for weak in &self.nodes {