summaryrefslogtreecommitdiff
path: root/src/semantic/frame.rs
diff options
context:
space:
mode:
authorDavid Li <li.davidm96@gmail.com>2017-11-28 20:16:25 -0500
committerDavid Li <li.davidm96@gmail.com>2017-11-28 20:16:25 -0500
commit9630b53836c0717a7ac0ab86dda3a4efb5bf9fb9 (patch)
treeb4dab117fe506f7d6f3b35d1a974492816343620 /src/semantic/frame.rs
parent84babea244bb8ef85c6b84fd63eeeedc85781c03 (diff)
Translate function callsHEADmaster
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,