Skip to content

Commit

Permalink
Updated scope-level initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
danielzsh committed Nov 2, 2020
1 parent 2292a05 commit aae648e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Interpreter/Symbols.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ class ProcedureSymbol : public Symbol {
class ScopedSymbolTable {
private:
std::string scope_name;
int scope_level;
public:
int scope_level;
ScopedSymbolTable* enclosingScope = NULL;
std::map<std::string, Symbol*> symbols;
ScopedSymbolTable(std::string name, int level) {
Expand Down Expand Up @@ -110,7 +110,7 @@ class SymbolTableBuilder {
ProcedureSymbol* proc_symbol = new ProcedureSymbol(proc.name);
currentScope.define(proc_symbol);
// cout << "Enter scope: " << proc.name << endl;
ScopedSymbolTable proc_scope(proc.name, 2);
ScopedSymbolTable proc_scope(proc.name, currentScope.scope_level + 1);
ScopedSymbolTable* enclosing = new ScopedSymbolTable(currentScope);
proc_scope.enclosingScope = enclosing;
currentScope = proc_scope;
Expand Down

0 comments on commit aae648e

Please sign in to comment.