Refactor for style
This commit is contained in:
@@ -82,12 +82,9 @@ impl CompiledFn {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn text(&self) -> Vec<String> {
|
||||
let preamble = self.preamble.0.clone();
|
||||
let body = self.body.0.clone();
|
||||
let outro = self.outro.0.clone();
|
||||
|
||||
[preamble, body, outro].into_iter().flatten().collect()
|
||||
/// Return an iterator over all the
|
||||
pub fn text(&self) -> impl Iterator<Item = &str> {
|
||||
self.preamble.0.iter().chain(self.body.0.iter()).chain(self.outro.0.iter()).map(String::as_str)
|
||||
}
|
||||
|
||||
/// 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:
|
||||
for (_, val) in state.functions.iter_mut() {
|
||||
asm.push(format!("{}:", val.label));
|
||||
asm.append(val.text().as_mut());
|
||||
for line in val.text() {
|
||||
asm.push(String::from(line));
|
||||
}
|
||||
}
|
||||
|
||||
// Strings:
|
||||
|
||||
Reference in New Issue
Block a user