8000 AST validate that a contract does not have a function with contract name by ferranbt · Pull Request #117 · paradigmxyz/solar · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged

Conversation

ferranbt
Copy link
Contributor

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.

Copy link
Contributor
@onbjerg onbjerg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@onbjerg onbjerg added C-enhancement Category: an issue proposing an enhancement or a PR with one A-sema Area: semantic analysis labels Nov 15, 2024
ferranbt and others added 3 commits November 18, 2024 19:11
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 {
Copy link
Contributor Author

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.

Copy link
Member

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 :)

@DaniPopes DaniPopes merged commit c3b47d5 into paradigmxyz:main Nov 18, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sema Area: semantic analysis C-enhancement Category: an issue proposing an enhancement or a PR with one
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0