Skip to content

Imports Support#95

Draft
LesterEvSe wants to merge 2 commits into
devfrom
feature/imports-v2
Draft

Imports Support#95
LesterEvSe wants to merge 2 commits into
devfrom
feature/imports-v2

Conversation

@LesterEvSe

Copy link
Copy Markdown
Collaborator
  • This PR suggests a bug fix and I've added the necessary tests.
  • This PR introduces a new feature and I've discussed the update in an Issue or with the team.
  • This PR is just a minor change like a typo fix.

Replaces #69. Now that SimplicityHL natively supports flattening (PR #337) functionality, it made more sense to rewrite this implementation from scratch in a clean PR rather than trying to salvage and rebase the old one

@LesterEvSe LesterEvSe self-assigned this Jun 11, 2026
@LesterEvSe LesterEvSe requested a review from Arvolear as a code owner June 11, 2026 13:06
@LesterEvSe LesterEvSe added the enhancement New feature or request label Jun 11, 2026
@LesterEvSe LesterEvSe linked an issue Jun 11, 2026 that may be closed by this pull request
@LesterEvSe LesterEvSe marked this pull request as draft June 11, 2026 14:23
@LesterEvSe LesterEvSe mentioned this pull request Jun 11, 2026
3 tasks
@LesterEvSe LesterEvSe force-pushed the feature/imports-v2 branch from 667340e to 4084ed0 Compare June 11, 2026 15:37
@LesterEvSe LesterEvSe changed the base branch from master to dev June 11, 2026 16:24
@LesterEvSe LesterEvSe force-pushed the feature/imports-v2 branch from 4084ed0 to 3cab2bd Compare June 12, 2026 10:44
Comment thread crates/build/src/resolver.rs Outdated
simf_dir: &CanonPath,
context: &CanonPath,
) -> Result<(), BuildError> {
for (drp_name, dep) in &deps_config.inner {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
for (drp_name, dep) in &deps_config.inner {
for (dep_name, dep) in &deps_config.inner {

Comment thread crates/build/src/resolver.rs Outdated
struct DepCollector<'a> {
builder: DependencyMapBuilder,
visited: HashSet<CanonPath>,
config_filename: &'a str,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's just use the constant everywhere instead of saving it here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Since we have an architecture where the cli crate loads the build crate, I cannot use the CONFIG_FILENAME constant inside the build. So I think a better solution is to just pass it to the function directly

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Makes sense, although I don't like that. Can we at least store String to avoid the lifetime code noise?

Comment on lines +134 to +139
self.builder
.add_dependency(simf_dir.clone(), drp_name.clone(), loaded_simf_dir.clone());

if !self.visited.insert(loaded_context.clone()) {
continue;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is it intended to add_dependency before the visited check?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yep, I will add the docstring for that

Comment thread crates/build/src/resolver.rs Outdated
}
}

pub fn build_dependency_map(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's not leave such functions hanging. Please add it either to the Resolver or Generator object.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

OK

Comment thread crates/build/src/generator.rs Outdated
Comment on lines +26 to +27
/// Intermediate Representation
const IR_SIMF_DIR: &str = "simf";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this be taken from the build config as well?

Suggested change
/// Intermediate Representation
const IR_SIMF_DIR: &str = "simf";
/// Flattened Representation
const FLAT_SIMF_DIR: &str = "simf";

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good idea, I will change it to DEFAULT_SRC_DIR_NAME

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I mean to use the src_dir variable.

@LesterEvSe LesterEvSe force-pushed the feature/imports-v2 branch from 3cab2bd to e509d10 Compare June 12, 2026 14:41
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.

Dependencies management

2 participants