public object visitReturnStmt(Stmt.Return stmt) { object value = null; if (stmt.value != null) { value = evaluate(stmt.value); } throw new Return(value); }
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); }