Open mtrofin opened 6 months ago
FWIW, it may be more tricky than it seems. The Error
case is straightforward, the Expect<T>
isn't. In the OutputSizeLimitTest.cpp
example, the goal is to assign Var
to *Expect
, while in the ResourceScriptParser.cpp
example, Var
gets assigned Expect
. Then, here it gets more interesting, with references and const references.
Maybe we end up with a few macros, but then again, maybe having these macros n-plicated isn't so bad afterall.
Also:
ErrorOr
. ASSIGN_OR_ERROR
(and RETURN_IF_ERROR
) is a very good name, it's also unfortunately taken by abseil. If these appear in a header, it will complicate codebases where llvm and abseil mix.
Examples:
RETURN_IF_ERROR
andASSIGN_OR_RETURN
or these with a slightly different name.The idea is to place them in Error.h