Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename @remove to @removemeta #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ using ExpressionPatterns.Dispatch.MetaUtilities

@metaconflicts @f #> <<z> <x+y>> | <<x+y> <y>>

@remove @f(z,x+y)
@removemeta @f(z,x+y)

@metaconflicts @f #> nothing

Expand Down
18 changes: 9 additions & 9 deletions src/Dispatch/MetaUtilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using ...Dispatch.TopMetaTables
import ...Dispatch.Applications: MACROMETHODS, METAFUNCTIONS
import ...Dispatch.TableManipulation: print_conflicts
import Base.Meta: quot
export @prefer, @whichmeta, @remove, @importmeta, @metamethods, @metaconflicts
export @prefer, @whichmeta, @removemeta, @importmeta, @metamethods, @metaconflicts

const MU = MetaUtilities
const MM = MACROMETHODS
Expand Down Expand Up @@ -75,15 +75,15 @@ conflictscode(m, typ, M=current_module()) =
# remove
#----------------------------------------------------------------------------

@macromethod remove( m(*{patterns})) = esc(removecode(m, patterns, :fun))
@macromethod remove( M.m(*{patterns})) = esc(removecode(m, patterns, :fun, M))
@macromethod remove( @m(*{patterns})) = esc(removecode(m, patterns, :macro))
@macromethod remove(M.@m(*{patterns})) = esc(removecode(m, patterns, :macro, M))
@macromethod removemeta( m(*{patterns})) = esc(removecode(m, patterns, :fun))
@macromethod removemeta( M.m(*{patterns})) = esc(removecode(m, patterns, :fun, M))
@macromethod removemeta( @m(*{patterns})) = esc(removecode(m, patterns, :macro))
@macromethod removemeta(M.@m(*{patterns})) = esc(removecode(m, patterns, :macro, M))

@macromethod remove(label, :L{from}, m) = esc(removecode(m, label, :fun))
@macromethod remove(label, :L{from}, M.m) = esc(removecode(m, label, :fun, M))
@macromethod remove(label, :L{from}, @m) = esc(removecode(m, label, :macro))
@macromethod remove(label, :L{from}, M.@m) = esc(removecode(m, label, :macro, M))
@macromethod removemeta(label, :L{from}, m) = esc(removecode(m, label, :fun))
@macromethod removemeta(label, :L{from}, M.m) = esc(removecode(m, label, :fun, M))
@macromethod removemeta(label, :L{from}, @m) = esc(removecode(m, label, :macro))
@macromethod removemeta(label, :L{from}, M.@m) = esc(removecode(m, label, :macro, M))


#----------------------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions test/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ ypx = :(y+x)
@test @h(x+y) == [:x, :y]
@test h(:(x+y)) == [:x, :y]

@remove plus from @h
@remove plus from h
@removemeta plus from @h
@removemeta plus from h

@test @h(x+y) == [:(x+y)]
@test h(:(x+y)) == [:(x+y)]

@remove @h(x)
@remove h(x)
@removemeta @h(x)
@removemeta h(x)

@test_throws MetaMethodError @eval @h(x)
@test_throws MetaMethodError h(:x)
Expand Down