Run rustfmt

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-10-20 16:21:50 -07:00
parent ceda48988d
commit 692bb521ec
27 changed files with 402 additions and 251 deletions

View File

@@ -4,7 +4,7 @@ mod locals;
mod scope;
pub mod thunk;
use crate::{syn::ast::Body, obj::prelude::*, vm::consts::*};
use crate::{obj::prelude::*, syn::ast::Body, vm::consts::*};
use scope::*;
use std::collections::HashMap;
@@ -29,20 +29,28 @@ impl Compile {
.to_vec();
// XXX TODO(compile)
// remove this when we get returns implemented
main.push(crate::vm::inst::Inst::PushSym(crate::obj::reserved::NIL_NAME.sym));
main.push(crate::vm::inst::Inst::PushSym(
crate::obj::reserved::NIL_NAME.sym,
));
main.push(crate::vm::inst::Inst::Return);
let globals_syms: std::collections::BTreeMap<_, _> = self.pop_scope_layer().unwrap()
let globals_syms: std::collections::BTreeMap<_, _> = self
.pop_scope_layer()
.unwrap()
.into_iter()
.map(|(sym, name)| (name, sym))
.collect();
let globals = globals_syms.into_iter()
let globals = globals_syms
.into_iter()
.enumerate()
.map(|(index, (name, sym))| {
assert_eq!(index, name.index());
sym
})
.collect();
Ok((self.const_data.const_pool, UserFun::new_obj(main, globals, 0)))
Ok((
self.const_data.const_pool,
UserFun::new_obj(main, globals, 0),
))
}
/// Gets the constant data that is interned in this compile session.