checkpoint; builds again
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
use super::ast::{Expression, Program, Statement, TopLevel};
|
||||
use super::ast::{Expression, Program, TopLevel};
|
||||
use internment::ArcIntern;
|
||||
use std::collections::HashSet;
|
||||
|
||||
impl Program {
|
||||
impl<T> Program<T> {
|
||||
/// Get the complete list of strings used within the program.
|
||||
///
|
||||
/// For the purposes of this function, strings are the variables used in
|
||||
@@ -18,37 +18,18 @@ impl Program {
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevel {
|
||||
impl<T> TopLevel<T> {
|
||||
fn register_strings(&self, string_set: &mut HashSet<ArcIntern<String>>) {
|
||||
match self {
|
||||
TopLevel::Function(_, _, stmts, body) => {
|
||||
for stmt in stmts.iter() {
|
||||
stmt.register_strings(string_set);
|
||||
}
|
||||
body.register_strings(string_set);
|
||||
}
|
||||
TopLevel::Function(_, _, _, body) => body.register_strings(string_set),
|
||||
TopLevel::Statement(stmt) => stmt.register_strings(string_set),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Statement {
|
||||
fn register_strings(&self, string_set: &mut HashSet<ArcIntern<String>>) {
|
||||
match self {
|
||||
Statement::Binding(_, name, _, expr) => {
|
||||
string_set.insert(name.clone());
|
||||
expr.register_strings(string_set);
|
||||
}
|
||||
|
||||
Statement::Print(_, _, name) => {
|
||||
string_set.insert(name.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Expression {
|
||||
impl<T> Expression<T> {
|
||||
fn register_strings(&self, _string_set: &mut HashSet<ArcIntern<String>>) {
|
||||
// nothing has a string in here, at the moment
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user