Skip to content

Commit

Permalink
fix: only check name nodes for internal decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
z80dev committed Nov 11, 2023
1 parent 69fa296 commit c48270a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions examples/Foo.vy
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,8 @@ implements: Ownable
@external
def owner() -> address:
return self._owner

N_COINS: constant(uint256) = 2
A_MULTIPLIER: constant(uint256) = 10000

MIN_A: constant(uint256) = N_COINS**N_COINS * A_MULTIPLIER / 10
4 changes: 4 additions & 0 deletions tests/test_navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ def test_find_references_constant(doc, navigator):
references = navigator.find_references(doc, pos)
assert len(references) == 1

pos = Position(line=60, character=0)
references = navigator.find_references(doc, pos)
assert len(references) == 2


def test_find_references_function_local_var(doc, navigator):
pos = Position(line=20, character=5)
Expand Down
2 changes: 1 addition & 1 deletion vyper_lsp/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def get_internal_function_nodes(self):

for node in function_nodes:
for decorator in node.decorator_list:
if decorator.id == "internal":
if isinstance(decorator, nodes.Name) and decorator.id == "internal":
internal_nodes.append(node)

return internal_nodes
Expand Down

0 comments on commit c48270a

Please sign in to comment.