Beispiel #1
0
        public object VisitThisExpr(Expr.This expr)
        {
            if (currentClass == ClassType.NONE)
            {
                Lox.Error(expr.Keyword, "Cannot use 'this' outside of a class");
                return(null);
            }

            ResolveLocal(expr, expr.Keyword);
            return(null);
        }
Beispiel #2
0
        public Void Visit(Expr.This expr)
        {
            if (currentClass == ClassType.None)
            {
                Lox.Error(expr.Keyword, "Cannot use 'this' outside of a class.");
            }
            else
            {
                ResolveLocal(expr, expr.Keyword);
            }

            return(Void.Instance);
        }
Beispiel #3
0
 public object VisitThisExpr(Expr.This expr)
 {
     return(LookUpVariable(expr.Keyword, expr));
 }
Beispiel #4
0
 object Expr.IVisitor <object> .VisitThisExpr(Expr.This expr)
 {
     return(LookUpVariable(expr.keyword, expr));
 }
Beispiel #5
0
 public string VisitThisExpr(Expr.This expr)
 {
     throw new NotImplementedException();
 }
Beispiel #6
0
 object Expr.IVisitor <object> .VisitThisExpr(Expr.This expr)
 {
     ResolveLocal(expr, expr.keyword);
     return(null);
 }