Wire functions through everything, with some unimplemented, and add a basic scoped map.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use super::ast::{Expression, Program, Statement};
|
||||
use super::ast::{Expression, Program, Statement, TopLevel};
|
||||
use internment::ArcIntern;
|
||||
use std::collections::HashSet;
|
||||
|
||||
@@ -10,7 +10,7 @@ impl Program {
|
||||
pub fn strings(&self) -> HashSet<ArcIntern<String>> {
|
||||
let mut result = HashSet::new();
|
||||
|
||||
for stmt in self.statements.iter() {
|
||||
for stmt in self.items.iter() {
|
||||
stmt.register_strings(&mut result);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,15 @@ impl Program {
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevel {
|
||||
fn register_strings(&self, string_set: &mut HashSet<ArcIntern<String>>) {
|
||||
match self {
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user