diff --git a/README.md b/README.md index 2a5b1c2..4ca3f99 100644 --- a/README.md +++ b/README.md @@ -117,15 +117,9 @@ From a constructed RuntimeGeneratedFunction, you can retrieve the expressions us `RuntimeGeneratedFunctions.get_expression` command. For example: ```julia +julia> RuntimeGeneratedFunctions.get_expression(rgf) ex = :((x) -> x^2) rgf = @RuntimeGeneratedFunction(ex) -julia> RuntimeGeneratedFunctions.get_expression(rgf) -#= -quote - #= c:\Users\accou\OneDrive\Computer\Desktop\test.jl:39 =# - x ^ 2 -end -=# ``` This can be used to get the expression even if `drop_expr` has been performed. diff --git a/docs/src/index.md b/docs/src/index.md index 42af531..eae610c 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -108,13 +108,9 @@ From a constructed RuntimeGeneratedFunction, you can retrieve the expressions us `RuntimeGeneratedFunctions.get_expression` command. For example: ```julia +julia> RuntimeGeneratedFunctions.get_expression(rgf) ex = :((x) -> x^2) rgf = @RuntimeGeneratedFunction(ex) -julia> RuntimeGeneratedFunctions.get_expression(rgf) -:((x,)->begin - #= REPL[14]:1 =# - x ^ 2 - end) ``` This can be used to get the expression even if `drop_expr` has been performed. @@ -198,7 +194,6 @@ julia> RuntimeGeneratedFunctions.get_expression(prob.f.f.f_oop) end) ``` - ## Reproducibility ```@raw html diff --git a/src/RuntimeGeneratedFunctions.jl b/src/RuntimeGeneratedFunctions.jl index d8c847c..ff5f633 100644 --- a/src/RuntimeGeneratedFunctions.jl +++ b/src/RuntimeGeneratedFunctions.jl @@ -304,7 +304,8 @@ function closures_to_opaque(ex::Expr, return_type = nothing) fdef[:body] = body name = get(fdef, :name, nothing) name !== nothing && delete!(fdef, :name) - opaque = Expr(:., Expr(:., :Base, QuoteNode(:Experimental)), QuoteNode(Symbol("@opaque"))) + opaque = Expr( + :., Expr(:., :Base, QuoteNode(:Experimental)), QuoteNode(Symbol("@opaque"))) _ex = Expr(:macrocall, opaque, LineNumberNode(0), combinedef(fdef)) # TODO: emit named opaque closure for better stacktraces # (ref https://github.com/JuliaLang/julia/pull/40242) @@ -332,11 +333,11 @@ end function get_expression(rgf::RuntimeGeneratedFunction{argnames, cache_tag, context_tag, id, B}) where { - argnames, - cache_tag, - context_tag, - id, - B + argnames, + cache_tag, + context_tag, + id, + B } func_expr = Expr(:->, Expr(:tuple, argnames...), _lookup_body(cache_tag, id)) end diff --git a/test/runtests.jl b/test/runtests.jl index 3db5a76..640e188 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -186,6 +186,6 @@ deserialized_f, deserialized_g = deserialize(buf) @test deserialized_g.body isa Nothing # deepcopy -ff = @RuntimeGeneratedFunction(:(x -> [x, x+1])) +ff = @RuntimeGeneratedFunction(:(x -> [x, x + 1])) @test deepcopy(ff) == ff @test deepcopy(ff) === ff