Refactor for style
This commit is contained in:
@@ -82,12 +82,9 @@ impl CompiledFn {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn text(&self) -> Vec<String> {
|
/// Return an iterator over all the
|
||||||
let preamble = self.preamble.0.clone();
|
pub fn text(&self) -> impl Iterator<Item = &str> {
|
||||||
let body = self.body.0.clone();
|
self.preamble.0.iter().chain(self.body.0.iter()).chain(self.outro.0.iter()).map(String::as_str)
|
||||||
let outro = self.outro.0.clone();
|
|
||||||
|
|
||||||
[preamble, body, outro].into_iter().flatten().collect()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Emit and emit arg should just be delegated to `body`
|
/// Emit and emit arg should just be delegated to `body`
|
||||||
|
|||||||
@@ -47,7 +47,9 @@ pub fn build_boot(src: &str) -> Result<Vec<String>, CompileError> {
|
|||||||
// Now start dumping compiled objects into there. First functions:
|
// Now start dumping compiled objects into there. First functions:
|
||||||
for (_, val) in state.functions.iter_mut() {
|
for (_, val) in state.functions.iter_mut() {
|
||||||
asm.push(format!("{}:", val.label));
|
asm.push(format!("{}:", val.label));
|
||||||
asm.append(val.text().as_mut());
|
for line in val.text() {
|
||||||
|
asm.push(String::from(line));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Strings:
|
// Strings:
|
||||||
|
|||||||
Reference in New Issue
Block a user