Skip to content

Commit

Permalink
add merge function
Browse files Browse the repository at this point in the history
  • Loading branch information
MicroProofs committed Mar 21, 2023
1 parent 38660a8 commit 382df46
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions crates/aiken-lang/src/air.rs
Expand Up @@ -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 {
Expand All @@ -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 {}
}

0 comments on commit 382df46

Please sign in to comment.