diff options
author | Andreas Kling <kling@serenityos.org> | 2021-11-10 11:54:54 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-10 21:58:58 +0100 |
commit | cd49f30bea734feb9ac46d637e2ed3439e47e3c3 (patch) | |
tree | fd2b1f85385d09b383f6c3ac3e694f3834a7e7f3 /AK/Try.h | |
parent | 5f7d008791f9e358638283dc2f0d709a601344ff (diff) | |
download | serenity-cd49f30bea734feb9ac46d637e2ed3439e47e3c3.zip |
AK+LibJS: Simplify MUST() and move it from LibJS to AK/Try.h
This is generally useful so let's move it to AK. Also it seems that we
don't need the temporary variable hack anymore, so let's lose that.
Diffstat (limited to 'AK/Try.h')
-rw-r--r-- | AK/Try.h | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -16,3 +16,10 @@ return _temporary_result.release_error(); \ _temporary_result.release_value(); \ }) + +#define MUST(expression) \ + ({ \ + auto _temporary_result = (expression); \ + VERIFY(!_temporary_result.is_error()); \ + _temporary_result.release_value(); \ + }) |