Skip to content

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

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open

feat: add SourceParser #300

wants to merge 15 commits into from

Conversation

DaniPopes
Copy link
Member

Allows persisting a shared solar_sema::Compiler throughout compilation and storing it inside of the output.

Copy link
Contributor

@0xrusowsky 0xrusowsky left a 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! 🚀☀️

Comment on lines +397 to +403
// 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());
}
}
Copy link
Contributor

@0xrusowsky 0xrusowsky Aug 21, 2025

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

@DaniPopes DaniPopes requested a review from 0xrusowsky August 21, 2025 17:47
DaniPopes added a commit to paradigmxyz/solar that referenced this pull request Aug 22, 2025
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: (),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😆

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

Successfully merging this pull request may close these issues.

4 participants