public Void Visit_VariableExpr(VariableExpr expr) { var name = (string)expr.name.value; if (_scopes.Count != 0) { var scope = _scopes.Peek(); var hasKey = scope.TryGetValue(name, out bool state); if (hasKey && state == false) { _errors.Add(new Error(expr.name, ErrorType.InitializerError, "Cannot read local variable in its own initializer.")); } } ResolveLocal(expr, expr.name); return(null); }
public object Visit_VariableExpr(VariableExpr expr) { return(LookUpVariable(expr.name, expr)); }
public ClassStmt(Token name, VariableExpr superclass, List <FunctionStmt> methods) { this.name = name; this.superclass = superclass; this.methods = methods; }
public string Visit_VariableExpr(VariableExpr expr) { return("(Var " + (string)expr.name.value + ")"); }