Beispiel #1
0
        public Void visitVariableExpr(Expr.Variable expr)
        {
            var a = scopes.Peek();

            if (scopes.Count != 0 && scopes.Peek()[expr.name.lexeme] == false)
            {
                Program.Error(expr.name, "Cannot read local variable in its own initializer.");
            }

            ResolveLocal(expr, expr.name);

            return(null);
        }
Beispiel #2
0
 public object visitVariableExpr(Expr.Variable expr)
 {
     return(environment.Get(expr.name));
 }