Construct an ABI result representation of the params of the block. This is needed for loops and for handling cases in which params flow as the block's results, i.e. in the presence of an empty then or else.
(&mut self)
| 108 | /// This is needed for loops and for handling cases in which params flow as |
| 109 | /// the block's results, i.e. in the presence of an empty then or else. |
| 110 | pub fn params<M>(&mut self) -> Result<&mut ABIResults> |
| 111 | where |
| 112 | M: MacroAssembler, |
| 113 | { |
| 114 | if self.params.is_some() { |
| 115 | return Ok(self.params.as_mut().unwrap()); |
| 116 | } |
| 117 | |
| 118 | let params_as_results = match &self.ty { |
| 119 | BlockType::Void | BlockType::Single(_) => { |
| 120 | <M::ABI as ABI>::abi_results(&[], &CallingConvention::Default) |
| 121 | } |
| 122 | BlockType::Func(f) => { |
| 123 | <M::ABI as ABI>::abi_results(f.params(), &CallingConvention::Default) |
| 124 | } |
| 125 | // Once we have created a block type from a known signature, we |
| 126 | // can't modify its meaning. This should only be used for the |
| 127 | // function body block, in which case there's no need for treating |
| 128 | // params as results. |
| 129 | BlockType::ABISig(_) => unreachable!(), |
| 130 | }; |
| 131 | |
| 132 | self.params = Some(params_as_results?); |
| 133 | Ok(self.params.as_mut().unwrap()) |
| 134 | } |
| 135 | |
| 136 | /// Returns the signature param count. |
| 137 | pub fn param_count(&self) -> usize { |
no test coverage detected