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

Feature: Query via typed AST #10

Open
sambacha opened this issue Jul 20, 2022 · 4 comments
Open

Feature: Query via typed AST #10

sambacha opened this issue Jul 20, 2022 · 4 comments

Comments

@sambacha
Copy link

AST Query

TLDR: Provide an AST pattern, and see details about when that pattern was introduced.

Overview

This enables a much easier way to understand how or why a pattern was introduced. For instance, you can answer questions such as:

  • Which devs are using solmate, and which are using open-zeppelin?
  • Chronologically, when has each package been used? Do we see a shift over time?

To query the codebase to search for such a pattern, we can specify an AST selector as it would be accepted by Forge Lint.

AST selector is supported on AST Explorer for solidity.

For instance, to search for console.log() calls in javascript, the ESLint selector would be

"CallExpression[callee.object.name=console][callee.property.name=log]"

Other use cases

This could be used to help automate refactoring, finding regressions, and more since the debugger is based on a typed AST.

References

see ref. implementation for ESLint, https://github.com/NickHeiner/query-pattern-age/tree/use-in-tv#query-pattern-age

@cd1m0
Copy link
Collaborator

cd1m0 commented Apr 17, 2023

Is this report meant to be subimtted to the solc-typed-ast repo?

@sambacha
Copy link
Author

Is this report meant to be subimtted to the solc-typed-ast repo?

Imma be real with you i opened this issue as a way to reference the idea - bookmark it for myself

@sambacha
Copy link
Author

Really why not just go to yul ir that would be better

@cd1m0
Copy link
Collaborator

cd1m0 commented Apr 18, 2023

Could you provide more context about what you mean by "going to yul ir" in the context of the solidity debugger?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants