Rename "Local" to "Name" when referring to variables during compilation

* Variables were previously named "Local"s because they described a
  local variable - however, this is kind of a misnomer because it
  handles globals as well. This has been changed pretty much everywhere
  when appropriate (hopefully).
* Renamed obj/names.rs to obj/reserved.rs, freeing up the "names" module
  for the new Names handle
* Renamed obj/locals.rs to obj/names.rs, see above

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-09-18 13:57:51 -07:00
parent 7228732128
commit 0d6f68216b
14 changed files with 114 additions and 111 deletions

View File

@@ -264,7 +264,7 @@ impl Visit for CompileBody<'_> {
let attr = global_sym(expr.access.to_string());
thunk.push(Inst::SetAttr(attr));
}
LhsExpr::Local(local_name) => {
LhsExpr::Name(local_name) => {
let sym = global_sym(local_name.to_string());
let local = self.compile.lookup_scope_or_create_global(sym);
thunk = Inst::Pop(Some(local)).into();
@@ -349,9 +349,9 @@ impl Visit for CompileBody<'_> {
let thunk = match atom {
Atom::Ident(ident) => {
let sym = global_sym(ident.to_string());
let local = self.compile.lookup_scope_or_create_global(sym);
let name = self.compile.lookup_scope_or_create_global(sym);
// get local
Inst::PushLocal(local).into()
Inst::LoadName(name).into()
}
Atom::Sym(sym) => {
// push symbol