Skip to content

Commit

Permalink
Deprecation contains -> occursin
Browse files Browse the repository at this point in the history
  • Loading branch information
mauro3 committed May 21, 2018
1 parent dc43c63 commit 8ebe71a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion REQUIRE
@@ -1,2 +1,2 @@
julia 0.6
Compat 0.54
Compat 0.62
4 changes: 2 additions & 2 deletions src/match.jl
Expand Up @@ -11,7 +11,7 @@ function store!(env, name, ex)
end

isbinding(s) = false
isbinding(s::Symbol) = contains(string(s), r"[^_]_(_str)?$")
isbinding(s::Symbol) = occursin(r"[^_]_(_str)?$", string(s))

function bname(s::Symbol)
Symbol(Base.match(r"^@?(.*?)_+(_str)?$", string(s)).captures[1])
Expand All @@ -26,7 +26,7 @@ match_inner(pat::QuoteNode, ex::QuoteNode, env) =
match(pat.value, ex.value, env)

isslurp(s) = false
isslurp(s::Symbol) = s == :__ || contains(string(s), r"[^_]__$")
isslurp(s::Symbol) = s == :__ || occursin(r"[^_]__$", string(s))

function slurprange(pat)
slurps = length(filter(isslurp, pat))
Expand Down
4 changes: 3 additions & 1 deletion src/types.jl
Expand Up @@ -4,7 +4,9 @@ struct TypeBind
end

istb(s) = false
istb(s::Symbol) = !(endswith(string(s), "_") || endswith(string(s), "_str")) && contains(string(s), "_")
istb(s::Symbol) = !(endswith(string(s), "_") ||
endswith(string(s), "_str")) &&
occursin("_", string(s))

tbname(s::Symbol) = Symbol(split(string(s), "_")[1])
tbname(s::TypeBind) = s.name
Expand Down
2 changes: 1 addition & 1 deletion src/utils.jl
Expand Up @@ -128,7 +128,7 @@ function inexpr(ex, x)
return result
end

isgensym(s::Symbol) = contains(string(s), "#")
isgensym(s::Symbol) = occursin("#", string(s))
isgensym(s) = false

function gensymname(x::Symbol)
Expand Down

0 comments on commit 8ebe71a

Please sign in to comment.