mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Make @try maydiscard.
This commit is contained in:
@@ -482,7 +482,7 @@ macro bool @ok(#expr) @builtin
|
|||||||
@require $defined(#expr!) : "Expected an optional expression"
|
@require $defined(#expr!) : "Expected an optional expression"
|
||||||
@require @assignable_to(#expr!!, $typeof(#v)) : `Type of #expr must be an optional of #v's type`
|
@require @assignable_to(#expr!!, $typeof(#v)) : `Type of #expr must be an optional of #v's type`
|
||||||
*>
|
*>
|
||||||
macro void? @try(#v, #expr) @builtin
|
macro void? @try(#v, #expr) @builtin @maydiscard
|
||||||
{
|
{
|
||||||
var res = #expr;
|
var res = #expr;
|
||||||
if (catch err = res) return err?;
|
if (catch err = res) return err?;
|
||||||
|
|||||||
Reference in New Issue
Block a user