-
-
Notifications
You must be signed in to change notification settings - Fork 836
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: improve ast output #2824
feat: improve ast output #2824
Changes from 15 commits
bb032fd
40625b2
d5ce824
0909ece
89eb21b
ac85b19
ee75428
2d5c302
3ddd716
3e9b8d0
ea482cf
f9c6c26
cba0c74
4621556
1d467f8
548ba23
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -87,6 +87,15 @@ def vyper_module(self) -> vy_ast.Module: | |||||||
|
||||||||
return self._vyper_module | ||||||||
|
||||||||
@property | ||||||||
def vyper_module_unfolded(self) -> vy_ast.Module: | ||||||||
if not hasattr(self, "_vyper_module_unfolded"): | ||||||||
self._vyper_module_unfolded = generate_unfolded_ast( | ||||||||
self.vyper_module, self.interface_codes | ||||||||
) | ||||||||
|
||||||||
return self._vyper_module_unfolded | ||||||||
|
||||||||
@property | ||||||||
def vyper_module_folded(self) -> vy_ast.Module: | ||||||||
if not hasattr(self, "_vyper_module_folded"): | ||||||||
|
@@ -184,6 +193,19 @@ def generate_ast(source_code: str, source_id: int, contract_name: str) -> vy_ast | |||||||
return vy_ast.parse_to_ast(source_code, source_id, contract_name) | ||||||||
|
||||||||
|
||||||||
def generate_unfolded_ast( | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you add a comment describing that the purpose of this phase is to generate an AST for tooling use? now that i think about it, i wonder if it breaks other downstream tools. is it possible to check, e.g. whether brownie still works with the unfolded AST? |
||||||||
vyper_module: vy_ast.Module, | ||||||||
interface_codes: Optional[InterfaceImports], | ||||||||
) -> vy_ast.Module: | ||||||||
|
||||||||
vy_ast.validation.validate_literal_nodes(vyper_module) | ||||||||
vy_ast.folding.replace_builtin_constants(vyper_module) | ||||||||
vy_ast.folding.replace_builtin_functions(vyper_module) | ||||||||
validate_semantics(vyper_module, interface_codes) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
|
||||||||
return vyper_module | ||||||||
|
||||||||
|
||||||||
def generate_folded_ast( | ||||||||
vyper_module: vy_ast.Module, | ||||||||
interface_codes: Optional[InterfaceImports], | ||||||||
|
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.
i think now
build_ast_dict
is dead code? can we just replace the oldbuild_ast_dict
body with the newbuild_unfolded_ast_dict
body?