Minor code rearrangement
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -418,7 +418,6 @@ impl Visit for CompileBody<'_> {
|
||||
fn visit_atom(&mut self, atom: &Atom) -> Self::Out {
|
||||
let thunk = match atom {
|
||||
Atom::Ident(ident) => {
|
||||
let sym = global_sym(ident.to_string());
|
||||
// Small gotcha:
|
||||
// Looking up a name will either result in a local or a global lookup. If it's
|
||||
// a local variable first, then it's determined as a local and that's the end
|
||||
@@ -427,6 +426,7 @@ impl Visit for CompileBody<'_> {
|
||||
//
|
||||
// This checks to make sure that it's both a local variable and that there's more
|
||||
// than one scope layer.
|
||||
let sym = global_sym(ident.to_string());
|
||||
if let (true, Some(local)) = (self.compile.scope().layers_len() > 1, self.compile.lookup_local(sym)) {
|
||||
// get local
|
||||
Inst::LoadLocal(local).into()
|
||||
|
||||
Reference in New Issue
Block a user