Skip to content

Commit

Permalink
Fix failing doctests from PR #31246.
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed May 6, 2019
1 parent f189ae4 commit ec1ec94
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions base/meta.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export quot,
@dump

"""
quot(ex)::Expr
Meta.quot(ex)::Expr
Quote expression `ex` to produce an expression with head `quote`. This can for instance be used to represent objects of type `Expr` in the AST.
See also the manual section about [QuoteNode](@ref man-quote-node).
Expand All @@ -23,20 +23,20 @@ See also the manual section about [QuoteNode](@ref man-quote-node).
julia> eval(quot(:x))
:x
julia> dump(quot(:x))
julia> dump(Meta.quot(:x))
Expr
head: Symbol quote
args: Array{Any}((1,))
1: Symbol x
julia> eval(quot(:(1+2)))
julia> eval(Meta.quot(:(1+2)))
:(1 + 2)
```
"""
quot(ex) = Expr(:quote, ex)

"""
isexpr(ex, head[, n])::Bool
Meta.isexpr(ex, head[, n])::Bool
Check if `ex` is an expression with head `head` and `n` arguments.
Expand All @@ -45,19 +45,19 @@ Check if `ex` is an expression with head `head` and `n` arguments.
julia> ex = :(f(x))
:(f(x))
julia> isexpr(ex, :block)
julia> Meta.isexpr(ex, :block)
false
julia> isexpr(ex, :call)
julia> Meta.isexpr(ex, :call)
true
julia> isexpr(ex, [:block, :call]) # multiple possible heads
julia> Meta.isexpr(ex, [:block, :call]) # multiple possible heads
true
julia> isexpr(ex, :call, 1)
julia> Meta.isexpr(ex, :call, 1)
false
julia> isexpr(ex, :call, 2)
julia> Meta.isexpr(ex, :call, 2)
true
```
"""
Expand All @@ -66,13 +66,13 @@ isexpr(@nospecialize(ex), heads::Union{Set,Vector,Tuple}) = isa(ex, Expr) && in(
isexpr(@nospecialize(ex), heads, n::Int) = isexpr(ex, heads) && length(ex.args) == n

"""
show_sexpr([io::IO,], ex)
Meta.show_sexpr([io::IO,], ex)
Show expression `ex` as a lisp style S-expression.
# Examples
```jldoctest
julia> show_sexpr(:(f(x, g(y,z))))
julia> Meta.show_sexpr(:(f(x, g(y,z))))
(:call, :f, :x, (:call, :g, :y, :z))
```
"""
Expand Down
2 changes: 1 addition & 1 deletion doc/src/manual/metaprogramming.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ However, in some situations it is necessary to quote code *without* performing i
This kind of quoting does not yet have syntax, but is represented internally
as an object of type `QuoteNode`:
```jldoctest interp1
julia> eval(quot(Expr(:$, :(1+2))))
julia> eval(Meta.quot(Expr(:$, :(1+2))))
3
julia> eval(QuoteNode(Expr(:$, :(1+2))))
Expand Down

0 comments on commit ec1ec94

Please sign in to comment.