Skip to content

Commit 517d645

Browse files
committed
improve toplevel binding detection logic
1 parent df93c72 commit 517d645

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/refactor.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ function renamerefactor(
3030
end
3131

3232
expr = CSTParser.parse(context)
33-
bind = CSTParser.bindingof(expr)
33+
items = toplevelitems(expr, context)
34+
ind = findfirst(item -> item isa ToplevelBinding, items)
35+
bind = ind === nothing ? nothing : items[ind].bind
3436

3537
# local rename refactor if `old` isn't a toplevel binding
3638
if bind === nothing || old bind.name

0 commit comments

Comments
 (0)