2 acceptance tests left to fix

This commit is contained in:
Kasey White
2023-03-27 11:01:18 -04:00
committed by Lucas
parent eef34b8f4b
commit 51a6589aac
4 changed files with 138 additions and 47 deletions

View File

@@ -12,6 +12,7 @@ use crate::{
use super::{air::Air, scope::Scope};
/// A builder for [`Air`].
#[derive(Debug)]
pub struct AirStack {
pub id_gen: Rc<IdGenerator>,
pub scope: Scope,
@@ -404,12 +405,14 @@ impl AirStack {
self.merge_child(body);
}
pub fn wrap_clause(&mut self) {
pub fn wrap_clause(&mut self, body: AirStack) {
self.new_scope();
self.air.push(Air::WrapClause {
scope: self.scope.clone(),
});
self.merge_child(body);
}
pub fn trace(&mut self, tipo: Arc<Type>) {
@@ -652,4 +655,33 @@ impl AirStack {
self.merge_child(void_stack);
}
pub fn define_func(
&mut self,
func_name: String,
module_name: String,
variant_name: String,
params: Vec<String>,
recursive: bool,
body_stack: AirStack,
) {
self.air.push(Air::DefineFunc {
scope: self.scope.clone(),
func_name,
module_name,
params,
recursive,
variant_name,
});
self.merge_child(body_stack);
}
pub fn noop(&mut self) {
self.new_scope();
self.air.push(Air::Noop {
scope: self.scope.clone(),
});
}
}