From c31455dfc39ee3b05e7a312ba00d9596da0befbd Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Wed, 25 Mar 2020 12:12:29 +0100 Subject: [PATCH] allow `return` in `@recipe` --- RecipesBase/.gitignore | 1 + RecipesBase/src/RecipesBase.jl | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/RecipesBase/.gitignore b/RecipesBase/.gitignore index 3f02ca741..46a00d5d7 100644 --- a/RecipesBase/.gitignore +++ b/RecipesBase/.gitignore @@ -2,3 +2,4 @@ *.jl.*.cov *.jl.mem Manifest.toml +dev/ diff --git a/RecipesBase/src/RecipesBase.jl b/RecipesBase/src/RecipesBase.jl index 2317f4fad..36c9c54b6 100644 --- a/RecipesBase/src/RecipesBase.jl +++ b/RecipesBase/src/RecipesBase.jl @@ -185,7 +185,9 @@ function process_recipe_body!(expr::Expr) set_expr end - # TODO elseif it's a @series macrocall, add a series block and push to the `series` list + elseif e.head == :return + # To allow `return` in recipes just extract the returned arguments. + expr.args[i] = first(e.args) elseif e.head != :call # we want to recursively replace the arrows, but not inside function calls