-
Notifications
You must be signed in to change notification settings - Fork 67
feat: add SourceParser
#300
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
base: main
Are you sure you want to change the base?
Conversation
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.
this is excellent, i can't spot anything incorrect. i only left some minor cmnts.
looking fwd to integrating it on foundry already! 🚀☀️
// Set error on the first source if any. This doesn't really have to be exact, as long | ||
// as at least one source has an error set it should be enough. | ||
if let Some(Err(diag)) = compiler.gcx().sess.emitted_errors() { | ||
if let Some(first) = parsed.first_mut() { | ||
first.1.data.parse_result = Err(diag.to_string()); | ||
} | ||
} |
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.
should we open a solar issue to expose a way to map diagnostics back to their source files? maybe something like one of these options?
- a method to query diagnostics emitted by a given file
compiler.gcx().sess.emitted_errors_by(path)
- a more generic method
compiler.gcx().sess.emitted_errors_by_source()
that returns a map of paths to their diagnostics
Introduce `solar_sema::Compiler`. This is a unified API for the full compiler pipeline, as well as encapsulating the `enter(|| _)` requirement by only allowing access to the context when inside of the closure. See the HIR example and tests for the usage diff. Migrations: - foundry-compilers foundry-rs/compilers#300 - foundry: foundry-rs/foundry#11371 Closes #370.
@@ -26,6 +26,15 @@ pub struct VyperImport { | |||
pub final_part: Option<String>, | |||
} | |||
|
|||
#[derive(Clone, Debug, Default)] | |||
pub struct VyperParser { | |||
_inner: (), |
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.
😆
Co-authored-by: onbjerg <[email protected]>
Allows persisting a shared
solar_sema::Compiler
throughout compilation and storing it inside of the output.