Skip to content

Commit

Permalink
Remove in the end
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Jan 15, 2020
1 parent 6db2167 commit 65ae926
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions src/parcel_snoopi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ function handle_kwbody(topmod::Module, m::Method, paramrepr, tt, fstr="fbody")
return nothing
end


function parcel(tinf::AbstractVector{Tuple{Float64,Core.MethodInstance}}; subst=Vector{Pair{String, String}}(), blacklist=String[])
pc = Dict{Symbol, Vector{String}}() # output
modgens = Dict{Module, Vector{Method}}() # methods with generators in a module
Expand Down Expand Up @@ -229,11 +228,7 @@ function parcel(tinf::AbstractVector{Tuple{Float64,Core.MethodInstance}}; subst=
paramrepr = map(T->reprcontext(topmod, T), Iterators.drop(tt.parameters, 1)) # all the rest of the args

# blacklist remover
for (iLine, line) in enumerate(pc[topmodname])
if any(occursin.(blacklist, line))
deleteat!(pc[topmodname], iLine)
end
end
pc[topmodname] = blacklist_remover(blacklist, pc[topmodname])

if any(str->occursin('#', str), paramrepr)
@debug "Skipping $tt due to argument types having anonymous bindings"
Expand Down Expand Up @@ -305,3 +300,25 @@ function parcel(tinf::AbstractVector{Tuple{Float64,Core.MethodInstance}}; subst=
end
return pc
end

"""
Search and removes blacklist from pcI
# Examples
```julia
blacklist = ["hi","bye"]
pcI = ["good","bad","hi","bye","no"]
blacklist_remover(blacklist, pcI)
```
"""
function blacklist_remover(blacklist, pcI)
idx=Vector{Int64}(undef,0)
for (iLine, line) in enumerate(pcI)
if any(occursin.(blacklist, line))
push!(idx, iLine)
end
end
deleteat!(pcI, idx)
return pcI
end

0 comments on commit 65ae926

Please sign in to comment.