示例#1
0
 public object visitThisExpr(Expr.This expr)
 {
     if (currentClass == ClassType.NONE)
     {
         Lox.ReportError(expr.keyword, "Can't use 'this' outside of a class.");
     }
     else if (currentFunction == FunctionType.STATIC)
     {
         Lox.ReportError(expr.keyword, "Can't use 'this' in a static method.");
     }
     else
     {
         ResolveLocal(expr, expr.keyword.lexeme, AccessType.RHS);
     }
     return(null);
 }
示例#2
0
 public string visitThisExpr(Expr.This expr)
 {
     throw new NotImplementedException();
 }
示例#3
0
 public object visitThisExpr(Expr.This expr)
 {
     return(LookUpVariable(expr));
 }