Honor replaced visual methods and correct event contracts
Verify Tessera GUI / verify (push) Failing after 7m43s

This commit is contained in:
2026-10-22 19:08:28 +08:00
parent 8d0dbbce29
commit 2b20976658
10 changed files with 349 additions and 44 deletions
+35 -1
View File
@@ -9,7 +9,7 @@ use crate::{
};
use endor_core::{
AnnotationType, CallEffect, CallSignature, ContextNativeFunction, NativeCallable,
NativeContext, NativeResult, ObjectRef, Value, Vm, VmError,
NativeContext, NativeResult, ObjectRef, ObjectStore, Value, Vm, VmError,
};
fn invalid(message: &'static str) -> VmError {
@@ -87,6 +87,40 @@ struct Method {
desktop: ObjectRef,
signature: CallSignature,
}
/// Only this actual implementation can use the matching intrinsic fast path.
pub(crate) fn is_intrinsic(
store: &ObjectStore,
function: ObjectRef,
name: &str,
desktop: ObjectRef,
) -> Result<bool, VmError> {
let Some(function) = store
.object(function)?
.payload()
.as_any()
.downcast_ref::<ContextNativeFunction>()
else {
return Ok(false);
};
let Some(method) = function.implementation::<Method>() else {
return Ok(false);
};
// Per-window desktops share the same nominal registry and intrinsic bodies.
let same_registry = method.desktop == desktop
|| matches!(
(store.get_attr(method.desktop, "types")?, store.get_attr(desktop, "types")?),
(Value::Object(left), Value::Object(right)) if left == right
);
Ok(same_registry
&& matches!(
(name, method.query),
("measure", Query::Measure)
| ("arrange", Query::Arrange)
| ("paint", Query::Paint)
| ("hitTest", Query::HitTest)
))
}
impl NativeCallable for Method {
fn signature(&self) -> Option<CallSignature> {
Some(self.signature.clone())