@@ -47,7 +47,7 @@ func (c *eventsCapability) CapabilityContracts() map[string]CapabilityMethodCont
4747 return map [string ]CapabilityMethodContract {
4848 method : {
4949 ValidateArgs : c .validatePublishContractArgs ,
50- ValidateReturn : c . validateMethodReturn (method ),
50+ ValidateReturn : capabilityValidateAnyReturn (method ),
5151 },
5252 }
5353}
@@ -73,7 +73,7 @@ func (c *eventsCapability) callPublish(exec *Execution, receiver Value, args []V
7373 if err != nil {
7474 return NewNil (), err
7575 }
76- return c . cloneMethodResult (c .name + ".publish" , result )
76+ return cloneCapabilityMethodResult (c .name + ".publish" , result )
7777}
7878
7979func (c * eventsCapability ) validatePublishContractArgs (args []Value , kwargs map [string ]Value , block Value ) error {
@@ -92,16 +92,3 @@ func (c *eventsCapability) validatePublishContractArgs(args []Value, kwargs map[
9292 }
9393 return validateCapabilityKwargsDataOnly (method , kwargs )
9494}
95-
96- func (c * eventsCapability ) validateMethodReturn (method string ) func (result Value ) error {
97- return func (result Value ) error {
98- return validateCapabilityTypedValue (method + " return value" , result , capabilityTypeAny )
99- }
100- }
101-
102- func (c * eventsCapability ) cloneMethodResult (method string , result Value ) (Value , error ) {
103- if err := validateCapabilityTypedValue (method + " return value" , result , capabilityTypeAny ); err != nil {
104- return NewNil (), err
105- }
106- return deepCloneValue (result ), nil
107- }
0 commit comments