MCPcopy Create free account
hub / github.com/diem/move / check_function_handle

Method check_function_handle

language/move-binary-format/src/check_bounds.rs:199–225  ·  view source on GitHub ↗
(&self, function_handle: &FunctionHandle)

Source from the content-addressed store, hash-verified

197 }
198
199 fn check_function_handle(&self, function_handle: &FunctionHandle) -> PartialVMResult<()> {
200 check_bounds_impl(self.view.module_handles(), function_handle.module)?;
201 check_bounds_impl(self.view.identifiers(), function_handle.name)?;
202 check_bounds_impl(self.view.signatures(), function_handle.parameters)?;
203 check_bounds_impl(self.view.signatures(), function_handle.return_)?;
204 // function signature type paramters must be in bounds to the function type parameters
205 let type_param_count = function_handle.type_parameters.len();
206 if let Some(sig) = self
207 .view
208 .signatures()
209 .get(function_handle.parameters.into_index())
210 {
211 for ty in &sig.0 {
212 self.check_type_parameter(ty, type_param_count)?
213 }
214 }
215 if let Some(sig) = self
216 .view
217 .signatures()
218 .get(function_handle.return_.into_index())
219 {
220 for ty in &sig.0 {
221 self.check_type_parameter(ty, type_param_count)?
222 }
223 }
224 Ok(())
225 }
226
227 fn check_field_handle(&self, field_handle: &FieldHandle) -> PartialVMResult<()> {
228 check_bounds_impl_opt(&self.view.struct_defs(), field_handle.owner)?;

Callers 1

Calls 7

check_bounds_implFunction · 0.85
check_type_parameterMethod · 0.80
module_handlesMethod · 0.45
identifiersMethod · 0.45
signaturesMethod · 0.45
lenMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected