add merge function

This commit is contained in:
Kasey White 2023-03-21 16:32:06 -04:00 committed by Lucas
parent 32d34d5fd3
commit 2d77ec1a6a
1 changed files with 14 additions and 6 deletions

View File

@ -432,12 +432,22 @@ impl<'a> AirEnv<'a> {
}
}
pub fn int(mut self, value: String) -> Self {
self.air.push(Air::Int {
pub fn merge(mut self, other: AirEnv) -> Self {
self.air.extend(other.air.into_iter());
self
}
pub fn int(self, value: String) -> Self {
let mut air = self.air.clone();
air.push(Air::Int {
scope: self.scope.clone(),
value,
});
self
AirEnv {
id_gen: self.id_gen,
scope: self.scope,
air,
}
}
pub fn string(mut self, value: String) -> Self {
@ -456,7 +466,5 @@ impl<'a> AirEnv<'a> {
self
}
// pub fn sequence(mut self, expressions: AirEnv) -> Self{
// }
// pub fn sequence(mut self, expressions: AirEnv) -> Self {}
}