Declares and compiles all functions in `functions`. Additionally creates a trampoline for each one of them.
(
&mut self,
functions: &[Function],
ctrl_planes: Vec<ControlPlane>,
)
| 144 | /// Declares and compiles all functions in `functions`. Additionally creates a trampoline for |
| 145 | /// each one of them. |
| 146 | pub fn add_functions( |
| 147 | &mut self, |
| 148 | functions: &[Function], |
| 149 | ctrl_planes: Vec<ControlPlane>, |
| 150 | ) -> Result<()> { |
| 151 | // Declare all functions in the file, so that they may refer to each other. |
| 152 | for func in functions { |
| 153 | self.declare_function(func)?; |
| 154 | } |
| 155 | |
| 156 | let ctrl_planes = ctrl_planes |
| 157 | .into_iter() |
| 158 | .chain(std::iter::repeat(ControlPlane::default())); |
| 159 | |
| 160 | // Define all functions and trampolines |
| 161 | for (func, ref mut ctrl_plane) in functions.iter().zip(ctrl_planes) { |
| 162 | self.define_function(func.clone(), ctrl_plane)?; |
| 163 | self.create_trampoline_for_function(func, ctrl_plane)?; |
| 164 | } |
| 165 | |
| 166 | Ok(()) |
| 167 | } |
| 168 | |
| 169 | /// Registers all functions in a [TestFile]. Additionally creates a trampoline for each one |
| 170 | /// of them. |
no test coverage detected