Skip to content

Implement Program AST generation in the Driver#280

Merged
KyrylR merged 1 commit intoBlockstreamResearch:dev/importsfrom
LesterEvSe:feature/resolve-order
Apr 13, 2026
Merged

Implement Program AST generation in the Driver#280
KyrylR merged 1 commit intoBlockstreamResearch:dev/importsfrom
LesterEvSe:feature/resolve-order

Conversation

@LesterEvSe
Copy link
Copy Markdown
Collaborator

@LesterEvSe LesterEvSe commented Apr 10, 2026

This PR integrates the previously written driver functionality to construct the unified Program AST structure.
Also, some errors were corrected here. For now, it's difficult to create effective error handling with the current type of handler, so this will be a task outside of these series of module PRs.

@LesterEvSe LesterEvSe requested a review from KyrylR April 10, 2026 12:42
@LesterEvSe LesterEvSe self-assigned this Apr 10, 2026
@LesterEvSe LesterEvSe requested a review from delta1 as a code owner April 10, 2026 12:42
@LesterEvSe LesterEvSe added the enhancement New feature or request label Apr 10, 2026
@LesterEvSe LesterEvSe force-pushed the feature/resolve-order branch from 2e81bb1 to ccc8c48 Compare April 10, 2026 12:58
Comment on lines +118 to +128
// 2. Ignore Modules
if matches!(elem, parse::Item::Module) {
continue;
}

// 3. Handle Types & Functions
let (name, vis) = match elem {
parse::Item::TypeAlias(a) => (a.name().as_inner(), a.visibility()),
parse::Item::Function(f) => (f.name().as_inner(), f.visibility()),
_ => unreachable!(),
};
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Combine those two instead of using unreachable

Comment on lines +135 to +143
if handler.has_errors() {
None
} else {
Some(Program {
items: items.into(),
files: construct_resolved_file_array(&self.paths, &resolutions),
span: *self.modules[0].parsed_program.as_ref(),
})
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's not use if-else

@LesterEvSe LesterEvSe force-pushed the feature/resolve-order branch from ccc8c48 to 63e5daf Compare April 13, 2026 11:09
@LesterEvSe LesterEvSe requested a review from KyrylR April 13, 2026 11:13
@LesterEvSe LesterEvSe force-pushed the feature/resolve-order branch from 63e5daf to 4b0b834 Compare April 13, 2026 11:36
Copy link
Copy Markdown
Collaborator

@KyrylR KyrylR left a comment

Choose a reason for hiding this comment

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

ACK 4b0b834; code review

@KyrylR KyrylR merged commit 4b0b834 into BlockstreamResearch:dev/imports Apr 13, 2026
11 checks passed
@KyrylR KyrylR mentioned this pull request Apr 13, 2026
6 tasks
@LesterEvSe LesterEvSe deleted the feature/resolve-order branch April 13, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants