-
Notifications
You must be signed in to change notification settings - Fork 53
AST validate that a contract does not have a function with contract name #117
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 priv 8000 acy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AST validate that a contract does not have a function with contract name #117
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
for item in body.iter() { | ||
if let ast::ItemKind::Function(ast::ItemFunction { kind, header, body: _ }) = &item.kind | ||
{ | ||
if *kind == ast::FunctionKind::Function { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure if there is a more idiomatic way to chain this if statements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There will be when let-chains are stabilized :)
This PR adds an AST validation check similar to this which verifies that a function does not have the same name as the contract.
Note, eventually this can be merged into a specific AST contract level checker.