diff --git a/examples/Foo.vy b/examples/Foo.vy index aa57892..d7ab2b3 100644 --- a/examples/Foo.vy +++ b/examples/Foo.vy @@ -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 diff --git a/tests/test_navigation.py b/tests/test_navigation.py index 41787ac..4ba7a27 100644 --- a/tests/test_navigation.py +++ b/tests/test_navigation.py @@ -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) diff --git a/vyper_lsp/ast.py b/vyper_lsp/ast.py index 9bac1dc..aa56f44 100644 --- a/vyper_lsp/ast.py +++ b/vyper_lsp/ast.py @@ -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