Skip to content

Commit

Permalink
Fix sample.
Browse files Browse the repository at this point in the history
  • Loading branch information
lerno committed Jan 9, 2025
1 parent 11f9365 commit c78bb45
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions resources/examples/contextfree/cleanup.c3
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ fn void Resource.deinit(Resource this) => io::printfn("close %s", this.name);
macro void! @open_with(String name; @body(Resource resource))
{
Resource resource = resource_init(name)!;
defer {
defer
{
io::printn("Using open_with to close");
resource.deinit();
}
Expand All @@ -46,7 +47,7 @@ fn Resource! prep_out(String out_name, String[] prep_names)

fn void main()
{
Resource writer = prep_out("out", String[] { "a", "b"});
Resource writer = prep_out("out", String[] { "a", "b"})!!;
defer writer.deinit();
io::printn("use out");
}

0 comments on commit c78bb45

Please sign in to comment.