summaryrefslogtreecommitdiff
path: root/src/semantic/frame.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/semantic/frame.rs')
-rw-r--r--src/semantic/frame.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/semantic/frame.rs b/src/semantic/frame.rs
index 95d18a1..5b7bfaa 100644
--- a/src/semantic/frame.rs
+++ b/src/semantic/frame.rs
@@ -14,11 +14,14 @@ pub enum Escape {
}
pub trait Frame {
- fn new(name: temp::TempLabel, formals: Vec<Escape>) -> Self;
+ fn new<I: Iterator<Item=Escape>>(name: temp::TempLabel, formals: I) -> Self;
fn name(&self) -> temp::TempLabel;
fn formals(&self) -> &[Location];
fn alloc_local(&mut self, temp: &mut temp::Temp, escapes: Escape) -> Location;
fn location_to_exp(&mut self, location: Location) -> ir::Expression;
+ fn to_exp(&self) -> ir::Expression {
+ ir::Expression::Name(self.name())
+ }
}
pub struct Amd64Frame {
@@ -27,7 +30,7 @@ pub struct Amd64Frame {
}
impl Frame for Amd64Frame {
- fn new(name: temp::TempLabel, formals: Vec<Escape>) -> Self {
+ fn new<I: Iterator<Item=Escape>>(name: temp::TempLabel, formals: I) -> Self {
Amd64Frame {
offset: 0,
name: name,