Skip to content

Commit

Permalink
comment: update wrong comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Yag000 committed Aug 11, 2023
1 parent d99ec20 commit fbbdff8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions crates/compiler/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,15 @@ impl Compiler {
// This step is extremely important. If it is not done then when shadowing variables
// and using the previous value we get an error. Because we would have assigned
// a new index to the symbol and the GetGlobal instruction would get a NULL
// value instead of the previous value. (corresponds to issue #11)
// value instead of the previous value. (corresponds to issue #8)
let symbol = match self.symbol_table.resolve(&s.name.value) {
Some(symbol) => match symbol.scope {
SymbolScope::Global => {
// A Local variable should never replace a global one
if self.symbol_table.has_outer() {
// This means that the symbol will
// be local and not global
// be local and not global, and thus not
// replace the global one
self.symbol_table.define(s.name.value)
} else {
symbol
Expand Down

0 comments on commit fbbdff8

Please sign in to comment.