Implemented variable scopes
This commit is contained in:
@ -8,9 +8,9 @@ import (
|
||||
// CompileAssign compiles an assign statement.
|
||||
func (f *Function) CompileAssign(node *ast.Assign) error {
|
||||
name := node.Name.Text()
|
||||
variable, exists := f.variables[name]
|
||||
variable := f.Variable(name)
|
||||
|
||||
if !exists {
|
||||
if variable == nil {
|
||||
return errors.New(&errors.UnknownIdentifier{Name: name}, f.File, node.Name.Position)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user