Skip to content

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

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think this is very useful in practice, we don't store this information

@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.

#[derive(Clone, Debug, Default)]
pub struct VyperParser {
_inner: (),
Copy link
Contributor

Choose a reason for hiding this comment

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

😆

@DaniPopes DaniPopes force-pushed the dani/parsed-sources branch from 1bd726e to f1413c4 Compare August 25, 2025 09:00
@DaniPopes DaniPopes self-assigned this Aug 25, 2025
@DaniPopes DaniPopes merged commit 4d5e52c into main Aug 25, 2025
29 of 30 checks passed
@DaniPopes DaniPopes deleted the dani/parsed-sources branch August 25, 2025 21:07
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