Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat[tool]: improvements to AST annotation #3829

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a4ef57e
add sha256sum to root ast node
charles-cooper Mar 2, 2024
f4a4482
export import info
charles-cooper Mar 2, 2024
3617783
add type decl info to user types
charles-cooper Mar 3, 2024
4763e8d
rename a field
charles-cooper Mar 3, 2024
f094cb5
add decl_node info to InterfaceT and ModuleT
charles-cooper Mar 3, 2024
27f30c2
add cache for sha256sum
charles-cooper Mar 3, 2024
971ee0d
change source_sha256sum to a property
charles-cooper Mar 3, 2024
7ae2850
fix lint
charles-cooper Mar 3, 2024
bba12fe
Merge branch 'master' into feat/integration/id-improvements
charles-cooper Mar 3, 2024
04894f0
wip
charles-cooper Mar 3, 2024
0d4b924
enrich type information
charles-cooper Mar 3, 2024
ea5a642
fix tests
charles-cooper Mar 3, 2024
96f2712
add a note
charles-cooper Mar 3, 2024
cb82470
tidy up a test
charles-cooper Mar 3, 2024
2bfd2e3
add tests for type exports and import info export
charles-cooper Mar 3, 2024
80d1cee
add to_dict for generics
charles-cooper Mar 3, 2024
5b9fb24
fix lint
charles-cooper Mar 3, 2024
4562039
fix MemberFunctionT to_dict
charles-cooper Mar 3, 2024
9d3d62e
remove dead function compare_nodes
charles-cooper Mar 4, 2024
00938a7
add typeclass to HashMapT
charles-cooper Mar 8, 2024
e9c8f32
add a comment
charles-cooper Mar 8, 2024
72a7baf
Merge branch 'master' into feat/integration/id-improvements
charles-cooper Mar 8, 2024
ff08456
fix for extcall
charles-cooper Mar 8, 2024
ea0719c
update tests
charles-cooper Mar 8, 2024
a8fda55
update _id for static array and tuples
charles-cooper Mar 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/unit/ast/nodes/test_binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def x():
"""
)

assert vy_ast.compare_nodes(expected, mutated)
assert expected == mutated


def test_binary_length():
Expand Down
14 changes: 5 additions & 9 deletions tests/unit/ast/nodes/test_compare_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,32 @@ def test_compare_different_node_clases():
right = vyper_ast.body[0].value

assert left != right
assert not vy_ast.compare_nodes(left, right)


def test_compare_different_nodes_same_class():
vyper_ast = vy_ast.parse_to_ast("[1, 2]")
left, right = vyper_ast.body[0].value.elements

assert left != right
assert not vy_ast.compare_nodes(left, right)


def test_compare_different_nodes_same_value():
vyper_ast = vy_ast.parse_to_ast("[1, 1]")
left, right = vyper_ast.body[0].value.elements

assert left != right
assert vy_ast.compare_nodes(left, right)


def test_compare_complex_nodes_same_value():
vyper_ast = vy_ast.parse_to_ast("[{'foo':'bar', 43:[1,2,3]}, {'foo':'bar', 43:[1,2,3]}]")
left, right = vyper_ast.body[0].value.elements
def test_compare_similar_node():
# test equality without node_ids
left = vy_ast.Int(value=1)
right = vy_ast.Int(value=1)

assert left != right
assert vy_ast.compare_nodes(left, right)
assert left == right


def test_compare_same_node():
vyper_ast = vy_ast.parse_to_ast("42")
node = vyper_ast.body[0].value

assert node == node
assert vy_ast.compare_nodes(node, node)
7 changes: 0 additions & 7 deletions tests/unit/ast/nodes/test_from_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ def test_kwargs():
assert new_node.value == 666


def test_compare_nodes():
old_node = vy_ast.parse_to_ast("foo = 42")
new_node = vy_ast.Int.from_node(old_node, value=666)

assert not vy_ast.compare_nodes(old_node, new_node)


def test_new_node_has_no_parent():
old_node = vy_ast.parse_to_ast("foo = 42")
new_node = vy_ast.Int.from_node(old_node, value=666)
Expand Down
Loading
Loading