Skip to content

Imports Support#95

Open
LesterEvSe wants to merge 3 commits into
devfrom
feature/imports-v2
Open

Imports Support#95
LesterEvSe wants to merge 3 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
Comment thread crates/build/src/resolver.rs Outdated
Comment thread crates/build/src/resolver.rs
Comment thread crates/build/src/resolver.rs Outdated
Comment thread crates/build/src/generator.rs Outdated
@LesterEvSe LesterEvSe force-pushed the feature/imports-v2 branch from 3cab2bd to e509d10 Compare June 12, 2026 14:41
@LesterEvSe LesterEvSe marked this pull request as ready for review June 15, 2026 10:42
Comment thread crates/build/src/generator.rs
Comment thread crates/build/src/generator.rs
Comment thread crates/build/src/config.rs Outdated
Comment thread crates/build/src/generator.rs
Comment thread crates/build/src/generator.rs
Comment thread crates/build/src/generator.rs
Comment thread crates/build/src/resolver.rs
Comment on lines +109 to +110
let re = RE.get_or_init(|| Regex::new(r"(?m)^\s*(pub\s+)?fn\s+main\s*\(").unwrap());
re.is_match(source)

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
let re = RE.get_or_init(|| Regex::new(r"(?m)^\s*(pub\s+)?fn\s+main\s*\(").unwrap());
re.is_match(source)
let re = RE.get_or_init(|| Regex::new(r"(?m)^\s*(pub\s+)?fn\s+main\s*\(").unwrap());
re.is_match(source)

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.

What if the main function is commented out?

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 question. We could strip all comments with regex and then check for a main function. But we would still have a problem with strings in the future. For example "fn main(", or telling that a "/* */" inside a string isn't actually a comment. So I am considering doing it with the parse function from HL

Comment thread crates/build/src/resolver.rs
Comment thread crates/build/Cargo.toml Outdated
Comment thread fixtures/simf/deps/math/simf/simple_op.simf Outdated
Comment thread fixtures/simf/deps/merkle/simf/build_root.simf Outdated
Comment thread fixtures/simf/imports/multidep.simf Outdated
Comment thread Cargo.toml Outdated
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