Skip to content

Commit

Permalink
support unbound refs in inline pass (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
tjjfvi authored Apr 2, 2024
1 parent 35eca58 commit f9aab33
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/transform/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl InlineState {
// Whether or not the tortoise should take a step
let mut parity = false;
while let Tree::Ref { nam } = hare {
let net = &book.nets[nam];
let Some(net) = &book.nets.get(nam) else { break };
if net.should_inline() {
hare = &net.root;
} else {
Expand Down
13 changes: 11 additions & 2 deletions tests/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ pub fn test_inline() {
@I = (:0:1)
@K = (:0:2)
@1234 = (:1:2 (:3:4))
@into = ((@era @num @abab @ref @def @eff @I @K) (@into @1234))
@foo = @bar
@bar = @baz
@baz = @unbound
@into = ((@era @num @abab @ref @def @eff @I @K) (@into @1234 @foo @bar @baz @unbound))
").unwrap(), @r###"
@1234 = (:1:2 (:3:4))
Expand All @@ -118,13 +121,19 @@ pub fn test_inline() {
@abab = (a b a b)
@bar = @unbound
@baz = @unbound
@def = @abab
@eff = @abab
@era = *
@into = ((* #123 @abab @abab @abab @abab (:0:1) (:0:2)) (@into @1234))
@foo = @unbound
@into = ((* #123 @abab @abab @abab @abab (:0:1) (:0:2)) (@into @1234 @unbound @unbound @unbound @unbound))
@num = #123
Expand Down

0 comments on commit f9aab33

Please sign in to comment.