Skip to content

Commit

Permalink
Make rename, rename! throw, not fail silently.
Browse files Browse the repository at this point in the history
  • Loading branch information
garborg committed Dec 30, 2014
1 parent f475913 commit 64e1f75
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/other/index.jl
Expand Up @@ -47,15 +47,11 @@ end

function rename!(x::Index, nms)
for (from, to) in nms
if haskey(x, from)
if haskey(x, to)
error("Tried renaming $from to $to, when $to already exists in the Index.")
end
x.lookup[to] = col = pop!(x.lookup, from)
if !isa(col, Array)
x.names[col] = to
end
if haskey(x, to)
error("Tried renaming $from to $to, when $to already exists in the Index.")
end
x.lookup[to] = col = pop!(x.lookup, from)
x.names[col] = to
end
return x
end
Expand Down

0 comments on commit 64e1f75

Please sign in to comment.