mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Fix sample.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
Reference in New Issue
Block a user