-
-
Notifications
You must be signed in to change notification settings - Fork 823
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: internal handling of imports (#3655)
this commit refactors how imports are handled internally. historically, vyper handled imports by using a preprocessing step (`extract_file_interface_imports`) which resolved imports to files and provided them to the compiler pipeline as pure inputs. however, this causes problems once the module system gets more complicated: - it mixes passes. resolving imports and loading the files should essentially be resolved during analysis, but instead they are being resolved before the compiler is even entered into(!) - it produces slightly different code paths into the main compiler entry point which introduces subtle bugs over time from scaffolding differences - relatedly, each entry point into the compiler has to maintain its own mechanism for resolving different kinds of inputs to the compiler (JSON interfaces vs .vy files at the moment). this commit replaces the external scaffolding with an "InputBundle" abstraction which essentially models how the compiler interacts with its inputs (depending on whether it is using the filesystem or JSON inputs). this makes the entry points to the compiler overall simpler, and have more consistent behavior. this commit also: - changes builtin interfaces so they are represented in the codebase as `.vy` files which are imported similarly to how regular (non-builtin) files are imported - simplifies the `compile_files` and `compile_json` pipelines - removes the `compile_codes` API, which was not actually more useful than the `compile_code` API (which is kept). - cleans up tests by introducing a `make_file` and `make_input_bundle` abstraction - simplifies and merges several files in the tests/cli/ directories - adds a test for multiple output selections in the standard json pipeline
- Loading branch information
1 parent
9ce56e7
commit 5d10ea0
Showing
49 changed files
with
1,448 additions
and
1,423 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.