| 39 | |
| 40 | impl<'a, 'b> FunctionBindgen<'a, 'b> { |
| 41 | pub(crate) fn new( |
| 42 | interface_gen: &'b mut InterfaceGenerator<'a>, |
| 43 | func_name: &'b str, |
| 44 | kind: &'b FunctionKind, |
| 45 | params: Box<[String]>, |
| 46 | results: Vec<TypeId>, |
| 47 | parameter_type: ParameterType, |
| 48 | result_type: Option<Type>, |
| 49 | ) -> FunctionBindgen<'a, 'b> { |
| 50 | let mut locals = Ns::default(); |
| 51 | // Ensure temporary variable names don't clash with parameter names: |
| 52 | for param in ¶ms[..] { |
| 53 | locals.tmp(param); |
| 54 | } |
| 55 | |
| 56 | Self { |
| 57 | interface_gen, |
| 58 | func_name, |
| 59 | kind, |
| 60 | params, |
| 61 | results, |
| 62 | src: String::new(), |
| 63 | locals, |
| 64 | block_storage: Vec::new(), |
| 65 | blocks: Vec::new(), |
| 66 | payloads: Vec::new(), |
| 67 | needs_cleanup: false, |
| 68 | import_return_pointer_area_size: 0, |
| 69 | import_return_pointer_area_align: 0, |
| 70 | resource_drops: Vec::new(), |
| 71 | is_block: false, |
| 72 | fixed_statments: Vec::new(), |
| 73 | parameter_type: parameter_type, |
| 74 | result_type: result_type, |
| 75 | resource_type_name: None, |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | fn lower_variant( |
| 80 | &mut self, |