Implemented variable scopes
This commit is contained in:
@ -14,9 +14,9 @@ func (f *Function) Compare(comparison *expression.Expression) error {
|
||||
|
||||
if left.IsLeaf() && left.Token.Kind == token.Identifier {
|
||||
name := left.Token.Text()
|
||||
variable, exists := f.variables[name]
|
||||
variable := f.Variable(name)
|
||||
|
||||
if !exists {
|
||||
if variable == nil {
|
||||
return errors.New(&errors.UnknownIdentifier{Name: name}, f.File, left.Token.Position)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user