Skip to content

Commit 56d5030

Browse files
authored
Merge pull request #73 from mauro3/m3/contains_deprecation
Deprecation contains -> occursin
2 parents dc43c63 + 8ebe71a commit 56d5030

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

REQUIRE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
julia 0.6
2-
Compat 0.54
2+
Compat 0.62

src/match.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function store!(env, name, ex)
1111
end
1212

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

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

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

3131
function slurprange(pat)
3232
slurps = length(filter(isslurp, pat))

src/types.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ struct TypeBind
44
end
55

66
istb(s) = false
7-
istb(s::Symbol) = !(endswith(string(s), "_") || endswith(string(s), "_str")) && contains(string(s), "_")
7+
istb(s::Symbol) = !(endswith(string(s), "_") ||
8+
endswith(string(s), "_str")) &&
9+
occursin("_", string(s))
810

911
tbname(s::Symbol) = Symbol(split(string(s), "_")[1])
1012
tbname(s::TypeBind) = s.name

src/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ function inexpr(ex, x)
128128
return result
129129
end
130130

131-
isgensym(s::Symbol) = contains(string(s), "#")
131+
isgensym(s::Symbol) = occursin("#", string(s))
132132
isgensym(s) = false
133133

134134
function gensymname(x::Symbol)

0 commit comments

Comments
 (0)