fix: expect void now checks for unit instead of expecting data
Args in validator are now fully expected on. Add new air FieldsEmpty to make checking for empty constructors easier
This commit is contained in:
@@ -5,6 +5,7 @@ use uplc::{builder::EXPECT_ON_LIST, builtins::DefaultFunction};
|
||||
|
||||
use crate::{
|
||||
ast::Span,
|
||||
builtins::void,
|
||||
tipo::{Type, ValueConstructor, ValueConstructorVariant},
|
||||
IdGenerator,
|
||||
};
|
||||
@@ -337,6 +338,16 @@ impl AirStack {
|
||||
self.merge_child(value);
|
||||
}
|
||||
|
||||
pub fn fields_empty(&mut self, value: AirStack) {
|
||||
self.new_scope();
|
||||
|
||||
self.air.push(Air::FieldsEmpty {
|
||||
scope: self.scope.clone(),
|
||||
});
|
||||
|
||||
self.merge_child(value);
|
||||
}
|
||||
|
||||
pub fn clause(
|
||||
&mut self,
|
||||
tipo: Arc<Type>,
|
||||
@@ -682,6 +693,19 @@ impl AirStack {
|
||||
scope: self.scope.clone(),
|
||||
});
|
||||
}
|
||||
|
||||
pub fn choose_unit(&mut self, value_stack: AirStack) {
|
||||
self.new_scope();
|
||||
|
||||
self.air.push(Air::Builtin {
|
||||
scope: self.scope.clone(),
|
||||
func: DefaultFunction::ChooseUnit,
|
||||
tipo: void(),
|
||||
count: DefaultFunction::ChooseUnit.arity(),
|
||||
});
|
||||
|
||||
self.merge_child(value_stack);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user