* Rename `sway_parse::Program` to `sway_parse::Module`
As a part of a larger refactor to introduce the concept of a `Program`
at a higher level, where a `Program` contains the root module along with
the set of entry points (main function or contract ABI).
* Refactor `sway_core::SwayParseTree` to `ParseProgram`
Introduces a `ParseProgram` type that represents the entire program in
its parsed state with a `ParseTree` for each module, ready for
type-checking to begin.
Also moves `ParseTree` and related types out of the crate root and into
the existing `parse_tree.rs` module.
* Introduce `TypedProgram`, `TypedModule` and related types
By introducing a `TypedProgram` type, we can more accurately represent
the resuling typed program and include the full module tree.
The new `TypedModule` type should be used instead of the old
`TypedParseTree` type.
* Type-check submodules within the new `TypedProgram` structure
Replaces the need for the old `import_new_file` and
`compile_inner_dependency` functions.
* Perform all control flow analysis after type checking
* Remove build_config and dead_code_graph from type checking
Previously these were necessary during type checking as we only had
access to the parsed, type-checked submodules during type checking. Now
that we parse all modules before type checking, and perform control flow
analysis after type checking, we can safely remove these unnecessary
arguments throughout type checking.
* Fix incorrect root module path from buildconfig during parsing
* Address clippy nits
* Update forc lock file for dirty match expression test
* Move `ParseModule`, `ParseProgram` into their own modules
Also moves some related types into their respective modules.
* Move `TypedProgram` and `TypedModule` into their own submodules
This removes `syntax_tree.rs` previously associated with the no longer
necessary `TypedParseTree` in favour of dedicated modules for each of
the `TypedProgram` and `TypedModule` types.
Related types and logic have been moved into their respective modules.
* Fix incorrect path handling in BuildConfig constructor
* Update sway-lsp for change from `TypedParseTree` to `TypedProgram`
* Refactor namespace and enums.
* clippy
* clippy
* Improvements to namespace API and declaration ABI.
* Introduce the trait and the type.
* More instances.
* Introduce the CreateTypeId trait.
* Introduce the MonomorphizeHelper trait.
* Improvements to monomorphization.
* Fix bug with node dependencies.
* Combine Unit Scruntinee and Tuple Scrutinee.
* Improve the MatcherResult type.
* Add recursive catchall pattern.
* Move match expression desugaring from parsing to type checking.
* Use some of the new methods.
* clippy
* Rename function.
* Add purity check back in.
* PR feedback.
* Replace the `impure` keyword with `#[storage(...)]` annotations.
* Ugh, that's the last time I try to resolve a merge conflict in the GitHub web editor. :(
* Update use of parse `Item`.
* remove unused, accidentally committed file
* add Spanned trait for types that have a span
* Move the `Spanned` trait from `sway-parse` to `sway-types` next to the `Span` declaration.
Co-authored-by: Toby Hutton <toby@grusly.com>
* Add declaration attributes to the parser.
These will parse Rust-like attributes for any top-level item.
E.g., `#[attrib(arg0, arg1)]`
They are ignored by the rest of the compiler at this stage.
* Small post-PR changes to attributes parser.
* Allow type arguments in struct call paths
* add longer call path for test
* allow side effects in code blocks
Co-authored-by: Alexander Hansen <alexanderhansen@AlexandersMBP2.home>
* remove pest::Span from sway_types::Span
* Add new parser implementation
* use new parser in sway-core
* Proper error handling in convert_parse_tree
* rename new-parser-again to sway-parse
* remove redundant test bin from sway-parse
* fix dependencies in sway-parse
* fix clippy lints
* put dependencies in alphabetical order
* run rustfmt
* record full span in TokenStream
* remove an unused function
* alphabetically sort workspace members
* add --use-orig-parser cli option
* rust rustfmt
* update crate metadata for sway-parse
* update forc docs for --use-orig-parser