Skip to content

SwiftSyntax: address some post-commit review comments #22469

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

Merged
merged 1 commit into from
Feb 8, 2019
Merged
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions utils/gyb_syntax_support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,26 +145,26 @@ def dedented_lines(description):

def hash_syntax_node(node):
# Hash into the syntax name and serialization code
result = hash((node.name, str(get_serialization_code(node.syntax_kind))))
result = hash((node.name, get_serialization_code(node.syntax_kind)))
for child in node.children:
# Hash into the expected child syntax
result = hash((result, child.syntax_kind))
# Hash into the child name
result = hash((result, child.name))
# Hash into whether the child is optional
result = hash((result, str(child.is_optional)))
result = hash((result, child.is_optional))
return result


def hash_token_syntax(token):
# Hash into the token name and serialization code
return hash((token.name, str(token.serialization_code)))
return hash((token.name, token.serialization_code))


def calculate_node_hash():
result = 0
for node in SYNTAX_NODES:
result = hash((result, hash_syntax_node(node=node)))
result = hash((result, hash_syntax_node(node)))
for token in SYNTAX_TOKENS:
result = hash((result, hash_token_syntax(token=token)))
result = hash((result, hash_token_syntax(token)))
return result