Return the ABI representation of the results of the block. This method will lazily initialize the results if not present.
(&mut self)
| 75 | /// Return the ABI representation of the results of the block. |
| 76 | /// This method will lazily initialize the results if not present. |
| 77 | pub fn results<M>(&mut self) -> Result<&mut ABIResults> |
| 78 | where |
| 79 | M: MacroAssembler, |
| 80 | { |
| 81 | if self.ty.is_sig() { |
| 82 | return match &mut self.ty { |
| 83 | BlockType::ABISig(sig) => Ok(&mut sig.results), |
| 84 | _ => unreachable!(), |
| 85 | }; |
| 86 | } |
| 87 | |
| 88 | if self.results.is_some() { |
| 89 | return Ok(self.results.as_mut().unwrap()); |
| 90 | } |
| 91 | |
| 92 | let results = match &self.ty { |
| 93 | BlockType::Void => <M::ABI as ABI>::abi_results(&[], &CallingConvention::Default), |
| 94 | BlockType::Single(ty) => { |
| 95 | <M::ABI as ABI>::abi_results(&[*ty], &CallingConvention::Default) |
| 96 | } |
| 97 | BlockType::Func(f) => { |
| 98 | <M::ABI as ABI>::abi_results(f.results(), &CallingConvention::Default) |
| 99 | } |
| 100 | BlockType::ABISig(_) => unreachable!(), |
| 101 | }; |
| 102 | |
| 103 | self.results = Some(results?); |
| 104 | Ok(self.results.as_mut().unwrap()) |
| 105 | } |
| 106 | |
| 107 | /// Construct an ABI result representation of the params of the block. |
| 108 | /// This is needed for loops and for handling cases in which params flow as |