Publish native arity and validate callback contracts before registration
Verify Tessera GUI / verify (push) Failing after 7m44s
Verify Tessera GUI / verify (push) Failing after 7m44s
This commit is contained in:
@@ -28,6 +28,10 @@ impl ObjectPayload for ObjectList {
|
||||
#[derive(Debug)]
|
||||
struct At(ObjectRef);
|
||||
impl NativeCallable for At {
|
||||
fn arity(&self) -> Option<endor_core::CallArity> {
|
||||
Some(endor_core::CallArity::exact(1))
|
||||
}
|
||||
|
||||
fn invoke(&self, cx: &mut NativeContext<'_>, args: &[Value]) -> Result<NativeResult, VmError> {
|
||||
let [Value::Number(index)] = args else {
|
||||
return Err(VmError::InvalidArgument("object list at expects an index"));
|
||||
@@ -94,6 +98,10 @@ pub struct Constructor {
|
||||
pub desktop: ObjectRef,
|
||||
}
|
||||
impl NativeCallable for Constructor {
|
||||
fn arity(&self) -> Option<endor_core::CallArity> {
|
||||
Some(endor_core::CallArity::range(1, usize::MAX))
|
||||
}
|
||||
|
||||
fn invoke(&self, cx: &mut NativeContext<'_>, args: &[Value]) -> Result<NativeResult, VmError> {
|
||||
let [Value::Object(definition), values @ ..] = args else {
|
||||
return Err(VmError::InvalidArgument("ObjectList type argument"));
|
||||
@@ -115,6 +123,8 @@ impl NativeCallable for Constructor {
|
||||
.ok_or(VmError::InvalidArgument(
|
||||
"missing ObjectList subclass fields",
|
||||
))?;
|
||||
cx.store()
|
||||
.check_class_field_arguments(*definition, &values[count..])?;
|
||||
let members = values[..count]
|
||||
.iter()
|
||||
.map(|value| {
|
||||
|
||||
Reference in New Issue
Block a user