Esempio n. 1
0
        public object visitReturnStmt(Stmt.Return stmt)
        {
            object value = null;

            if (stmt.value != null)
            {
                value = evaluate(stmt.value);
            }

            throw new Return(value);
        }
Esempio n. 2
0
 public object visitReturnStmt(Stmt.Return stmt)
 {
     if (currentFunction == FunctionType.NONE)
     {
         errorFunc(stmt.keyword, "Cannot return from top-level code.");
     }
     if (stmt.value != null)
     {
         resolve(stmt.value);
     }
     return(null);
 }