/work/obj-fuzz/dist/include/mozilla/Result.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
2 | | * vim: set ts=8 sts=4 et sw=4 tw=99: |
3 | | * This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | /* A type suitable for returning either a value or an error from a function. */ |
8 | | |
9 | | #ifndef mozilla_Result_h |
10 | | #define mozilla_Result_h |
11 | | |
12 | | #include "mozilla/Alignment.h" |
13 | | #include "mozilla/Assertions.h" |
14 | | #include "mozilla/Attributes.h" |
15 | | #include "mozilla/Types.h" |
16 | | #include "mozilla/TypeTraits.h" |
17 | | #include "mozilla/Variant.h" |
18 | | |
19 | | namespace mozilla { |
20 | | |
21 | | /** |
22 | | * Empty struct, indicating success for operations that have no return value. |
23 | | * For example, if you declare another empty struct `struct OutOfMemory {};`, |
24 | | * then `Result<Ok, OutOfMemory>` represents either success or OOM. |
25 | | */ |
26 | | struct Ok {}; |
27 | | |
28 | | template <typename E> class GenericErrorResult; |
29 | | template <typename V, typename E> class Result; |
30 | | |
31 | | namespace detail { |
32 | | |
33 | | enum class PackingStrategy { |
34 | | Variant, |
35 | | NullIsOk, |
36 | | LowBitTagIsError, |
37 | | PackedVariant, |
38 | | }; |
39 | | |
40 | | template <typename V, typename E, PackingStrategy Strategy> |
41 | | class ResultImplementation; |
42 | | |
43 | | template <typename V, typename E> |
44 | | class ResultImplementation<V, E, PackingStrategy::Variant> |
45 | | { |
46 | | mozilla::Variant<V, E> mStorage; |
47 | | |
48 | | public: |
49 | 95.0M | explicit ResultImplementation(V aValue) : mStorage(aValue) {} mozilla::detail::ResultImplementation<unsigned int, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(unsigned int) Line | Count | Source | 49 | 95.0M | explicit ResultImplementation(V aValue) : mStorage(aValue) {} |
Unexecuted instantiation: mozilla::detail::ResultImplementation<nsCOMPtr<nsITimer>, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsCOMPtr<nsITimer>) mozilla::detail::ResultImplementation<Pref*, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(Pref*) Line | Count | Source | 49 | 3 | explicit ResultImplementation(V aValue) : mStorage(aValue) {} |
mozilla::detail::ResultImplementation<mozilla::Ok, char const*, (mozilla::detail::PackingStrategy)0>::ResultImplementation(mozilla::Ok) Line | Count | Source | 49 | 3 | explicit ResultImplementation(V aValue) : mStorage(aValue) {} |
Unexecuted instantiation: mozilla::detail::ResultImplementation<nsCOMPtr<nsIRequest>, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsCOMPtr<nsIRequest>) Unexecuted instantiation: mozilla::detail::ResultImplementation<nsCOMPtr<nsIInputStream>, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsCOMPtr<nsIInputStream>) mozilla::detail::ResultImplementation<nsTString<char>, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsTString<char>) Line | Count | Source | 49 | 5 | explicit ResultImplementation(V aValue) : mStorage(aValue) {} |
mozilla::detail::ResultImplementation<nsCOMPtr<nsIFile>, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsCOMPtr<nsIFile>) Line | Count | Source | 49 | 9 | explicit ResultImplementation(V aValue) : mStorage(aValue) {} |
Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::URLPreloader::CacheKey, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(mozilla::URLPreloader::CacheKey) mozilla::detail::ResultImplementation<mozilla::FileLocation, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(mozilla::FileLocation) Line | Count | Source | 49 | 24 | explicit ResultImplementation(V aValue) : mStorage(aValue) {} |
mozilla::detail::ResultImplementation<nsTString<char> const, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsTString<char>) Line | Count | Source | 49 | 48 | explicit ResultImplementation(V aValue) : mStorage(aValue) {} |
Unexecuted instantiation: mozilla::detail::ResultImplementation<nsCSSValueSharedList*, mozilla::layers::BogusAnimation, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsCSSValueSharedList*) Unexecuted instantiation: mozilla::detail::ResultImplementation<nsIFrame*, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsIFrame*) Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::dom::MediaRecorder::Session::RunningState, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(mozilla::dom::MediaRecorder::Session::RunningState) Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned long, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(unsigned long) Unexecuted instantiation: mozilla::detail::ResultImplementation<int, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(int) Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::Result<mozilla::Ok, nsresult>, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(mozilla::Result<mozilla::Ok, nsresult>) Unexecuted instantiation: mozilla::detail::ResultImplementation<long, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(long) Unexecuted instantiation: mozilla::detail::ResultImplementation<RefPtr<mozilla::dom::Promise>, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(RefPtr<mozilla::dom::Promise>) Unexecuted instantiation: mozilla::detail::ResultImplementation<nsTString<char16_t>, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsTString<char16_t>) Unexecuted instantiation: mozilla::detail::ResultImplementation<nsCOMPtr<nsIZipReaderCache>, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsCOMPtr<nsIZipReaderCache>) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::jit::MInstruction*, js::jit::AbortReason, (mozilla::detail::PackingStrategy)0>::ResultImplementation(js::jit::MInstruction*) mozilla::detail::ResultImplementation<js::jit::MCall*, js::jit::AbortReason, (mozilla::detail::PackingStrategy)0>::ResultImplementation(js::jit::MCall*) Line | Count | Source | 49 | 70 | explicit ResultImplementation(V aValue) : mStorage(aValue) {} |
mozilla::detail::ResultImplementation<js::jit::MBasicBlock*, js::jit::AbortReason, (mozilla::detail::PackingStrategy)0>::ResultImplementation(js::jit::MBasicBlock*) Line | Count | Source | 49 | 70 | explicit ResultImplementation(V aValue) : mStorage(aValue) {} |
Unexecuted instantiation: mozilla::detail::ResultImplementation<js::jit::MDefinition*, js::jit::AbortReason, (mozilla::detail::PackingStrategy)0>::ResultImplementation(js::jit::MDefinition*) |
50 | 3 | explicit ResultImplementation(E aErrorValue) : mStorage(aErrorValue) {} Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned int, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsresult) Unexecuted instantiation: mozilla::detail::ResultImplementation<nsCOMPtr<nsITimer>, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsresult) Unexecuted instantiation: mozilla::detail::ResultImplementation<Pref*, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsresult) Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::Ok, char const*, (mozilla::detail::PackingStrategy)0>::ResultImplementation(char const*) Unexecuted instantiation: mozilla::detail::ResultImplementation<nsCOMPtr<nsIRequest>, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsresult) Unexecuted instantiation: mozilla::detail::ResultImplementation<nsCOMPtr<nsIInputStream>, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsresult) Unexecuted instantiation: mozilla::detail::ResultImplementation<nsTString<char>, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsresult) mozilla::detail::ResultImplementation<nsCOMPtr<nsIFile>, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsresult) Line | Count | Source | 50 | 3 | explicit ResultImplementation(E aErrorValue) : mStorage(aErrorValue) {} |
Unexecuted instantiation: mozilla::detail::ResultImplementation<nsTString<char> const, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsresult) Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::URLPreloader::CacheKey, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsresult) Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::FileLocation, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsresult) Unexecuted instantiation: mozilla::detail::ResultImplementation<nsCSSValueSharedList*, mozilla::layers::BogusAnimation, (mozilla::detail::PackingStrategy)0>::ResultImplementation(mozilla::layers::BogusAnimation) Unexecuted instantiation: mozilla::detail::ResultImplementation<nsIFrame*, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsresult) Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::dom::MediaRecorder::Session::RunningState, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsresult) Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned long, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsresult) Unexecuted instantiation: mozilla::detail::ResultImplementation<int, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsresult) Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::Result<mozilla::Ok, nsresult>, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsresult) Unexecuted instantiation: mozilla::detail::ResultImplementation<long, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsresult) Unexecuted instantiation: mozilla::detail::ResultImplementation<RefPtr<mozilla::dom::Promise>, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsresult) Unexecuted instantiation: mozilla::detail::ResultImplementation<nsTString<char16_t>, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsresult) Unexecuted instantiation: mozilla::detail::ResultImplementation<nsCOMPtr<nsIZipReaderCache>, nsresult, (mozilla::detail::PackingStrategy)0>::ResultImplementation(nsresult) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::jit::MInstruction*, js::jit::AbortReason, (mozilla::detail::PackingStrategy)0>::ResultImplementation(js::jit::AbortReason) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::jit::MCall*, js::jit::AbortReason, (mozilla::detail::PackingStrategy)0>::ResultImplementation(js::jit::AbortReason) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::jit::MBasicBlock*, js::jit::AbortReason, (mozilla::detail::PackingStrategy)0>::ResultImplementation(js::jit::AbortReason) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::jit::MDefinition*, js::jit::AbortReason, (mozilla::detail::PackingStrategy)0>::ResultImplementation(js::jit::AbortReason) |
51 | | |
52 | 95.0M | bool isOk() const { return mStorage.template is<V>(); } mozilla::detail::ResultImplementation<unsigned int, nsresult, (mozilla::detail::PackingStrategy)0>::isOk() const Line | Count | Source | 52 | 95.0M | bool isOk() const { return mStorage.template is<V>(); } |
mozilla::detail::ResultImplementation<nsTString<char> const, nsresult, (mozilla::detail::PackingStrategy)0>::isOk() const Line | Count | Source | 52 | 48 | bool isOk() const { return mStorage.template is<V>(); } |
mozilla::detail::ResultImplementation<Pref*, nsresult, (mozilla::detail::PackingStrategy)0>::isOk() const Line | Count | Source | 52 | 3 | bool isOk() const { return mStorage.template is<V>(); } |
mozilla::detail::ResultImplementation<mozilla::Ok, char const*, (mozilla::detail::PackingStrategy)0>::isOk() const Line | Count | Source | 52 | 3 | bool isOk() const { return mStorage.template is<V>(); } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<nsCOMPtr<nsIInputStream>, nsresult, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<nsCOMPtr<nsIRequest>, nsresult, (mozilla::detail::PackingStrategy)0>::isOk() const mozilla::detail::ResultImplementation<nsTString<char>, nsresult, (mozilla::detail::PackingStrategy)0>::isOk() const Line | Count | Source | 52 | 5 | bool isOk() const { return mStorage.template is<V>(); } |
mozilla::detail::ResultImplementation<nsCOMPtr<nsIFile>, nsresult, (mozilla::detail::PackingStrategy)0>::isOk() const Line | Count | Source | 52 | 12 | bool isOk() const { return mStorage.template is<V>(); } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::URLPreloader::CacheKey, nsresult, (mozilla::detail::PackingStrategy)0>::isOk() const mozilla::detail::ResultImplementation<mozilla::FileLocation, nsresult, (mozilla::detail::PackingStrategy)0>::isOk() const Line | Count | Source | 52 | 24 | bool isOk() const { return mStorage.template is<V>(); } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<nsCSSValueSharedList*, mozilla::layers::BogusAnimation, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<nsIFrame*, nsresult, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::dom::MediaRecorder::Session::RunningState, nsresult, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned long, nsresult, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<int, nsresult, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<long, nsresult, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<nsCOMPtr<nsITimer>, nsresult, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<nsTString<char16_t>, nsresult, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<RefPtr<mozilla::dom::Promise>, nsresult, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<nsCOMPtr<nsIZipReaderCache>, nsresult, (mozilla::detail::PackingStrategy)0>::isOk() const mozilla::detail::ResultImplementation<js::jit::MBasicBlock*, js::jit::AbortReason, (mozilla::detail::PackingStrategy)0>::isOk() const Line | Count | Source | 52 | 70 | bool isOk() const { return mStorage.template is<V>(); } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<js::jit::MInstruction*, js::jit::AbortReason, (mozilla::detail::PackingStrategy)0>::isOk() const mozilla::detail::ResultImplementation<js::jit::MCall*, js::jit::AbortReason, (mozilla::detail::PackingStrategy)0>::isOk() const Line | Count | Source | 52 | 70 | bool isOk() const { return mStorage.template is<V>(); } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<js::jit::MDefinition*, js::jit::AbortReason, (mozilla::detail::PackingStrategy)0>::isOk() const |
53 | | |
54 | | // The callers of these functions will assert isOk() has the proper value, so |
55 | | // these functions (in all ResultImplementation specializations) don't need |
56 | | // to do so. |
57 | 3.18M | V unwrap() const { return mStorage.template as<V>(); } mozilla::detail::ResultImplementation<unsigned int, nsresult, (mozilla::detail::PackingStrategy)0>::unwrap() const Line | Count | Source | 57 | 3.18M | V unwrap() const { return mStorage.template as<V>(); } |
mozilla::detail::ResultImplementation<nsTString<char> const, nsresult, (mozilla::detail::PackingStrategy)0>::unwrap() const Line | Count | Source | 57 | 48 | V unwrap() const { return mStorage.template as<V>(); } |
mozilla::detail::ResultImplementation<Pref*, nsresult, (mozilla::detail::PackingStrategy)0>::unwrap() const Line | Count | Source | 57 | 3 | V unwrap() const { return mStorage.template as<V>(); } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<nsCOMPtr<nsIInputStream>, nsresult, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<nsCOMPtr<nsIRequest>, nsresult, (mozilla::detail::PackingStrategy)0>::unwrap() const mozilla::detail::ResultImplementation<nsTString<char>, nsresult, (mozilla::detail::PackingStrategy)0>::unwrap() const Line | Count | Source | 57 | 5 | V unwrap() const { return mStorage.template as<V>(); } |
mozilla::detail::ResultImplementation<nsCOMPtr<nsIFile>, nsresult, (mozilla::detail::PackingStrategy)0>::unwrap() const Line | Count | Source | 57 | 9 | V unwrap() const { return mStorage.template as<V>(); } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::URLPreloader::CacheKey, nsresult, (mozilla::detail::PackingStrategy)0>::unwrap() const mozilla::detail::ResultImplementation<mozilla::FileLocation, nsresult, (mozilla::detail::PackingStrategy)0>::unwrap() const Line | Count | Source | 57 | 24 | V unwrap() const { return mStorage.template as<V>(); } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<nsCSSValueSharedList*, mozilla::layers::BogusAnimation, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<nsIFrame*, nsresult, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::dom::MediaRecorder::Session::RunningState, nsresult, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned long, nsresult, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<int, nsresult, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<long, nsresult, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<nsCOMPtr<nsITimer>, nsresult, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<nsTString<char16_t>, nsresult, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<RefPtr<mozilla::dom::Promise>, nsresult, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<nsCOMPtr<nsIZipReaderCache>, nsresult, (mozilla::detail::PackingStrategy)0>::unwrap() const mozilla::detail::ResultImplementation<js::jit::MBasicBlock*, js::jit::AbortReason, (mozilla::detail::PackingStrategy)0>::unwrap() const Line | Count | Source | 57 | 70 | V unwrap() const { return mStorage.template as<V>(); } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<js::jit::MInstruction*, js::jit::AbortReason, (mozilla::detail::PackingStrategy)0>::unwrap() const mozilla::detail::ResultImplementation<js::jit::MCall*, js::jit::AbortReason, (mozilla::detail::PackingStrategy)0>::unwrap() const Line | Count | Source | 57 | 70 | V unwrap() const { return mStorage.template as<V>(); } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<js::jit::MDefinition*, js::jit::AbortReason, (mozilla::detail::PackingStrategy)0>::unwrap() const |
58 | 3 | E unwrapErr() const { return mStorage.template as<E>(); } Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned int, nsresult, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<nsTString<char> const, nsresult, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::Ok, char const*, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<Pref*, nsresult, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<nsCOMPtr<nsIInputStream>, nsresult, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<nsCOMPtr<nsIRequest>, nsresult, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<nsTString<char>, nsresult, (mozilla::detail::PackingStrategy)0>::unwrapErr() const mozilla::detail::ResultImplementation<nsCOMPtr<nsIFile>, nsresult, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Line | Count | Source | 58 | 3 | E unwrapErr() const { return mStorage.template as<E>(); } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::URLPreloader::CacheKey, nsresult, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::FileLocation, nsresult, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<nsIFrame*, nsresult, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned long, nsresult, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<int, nsresult, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<long, nsresult, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<nsCOMPtr<nsITimer>, nsresult, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<nsTString<char16_t>, nsresult, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<RefPtr<mozilla::dom::Promise>, nsresult, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<nsCOMPtr<nsIZipReaderCache>, nsresult, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::jit::MBasicBlock*, js::jit::AbortReason, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::jit::MInstruction*, js::jit::AbortReason, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::jit::MCall*, js::jit::AbortReason, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::jit::MDefinition*, js::jit::AbortReason, (mozilla::detail::PackingStrategy)0>::unwrapErr() const |
59 | | }; |
60 | | |
61 | | /** |
62 | | * mozilla::Variant doesn't like storing a reference. This is a specialization |
63 | | * to store E as pointer if it's a reference. |
64 | | */ |
65 | | template <typename V, typename E> |
66 | | class ResultImplementation<V, E&, PackingStrategy::Variant> |
67 | | { |
68 | | mozilla::Variant<V, E*> mStorage; |
69 | | |
70 | | public: |
71 | 0 | explicit ResultImplementation(V aValue) : mStorage(aValue) {} Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::AssertedDeclaredKind, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::AssertedDeclaredKind) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::BinaryOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::BinaryOperator) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::CompoundAssignmentOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::CompoundAssignmentOperator) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::UnaryOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::UnaryOperator) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::UpdateOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::UpdateOperator) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::VariableDeclarationKind, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::VariableDeclarationKind) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::AssertedDeclaredKind, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::AssertedDeclaredKind) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::BinaryOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::BinaryOperator) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::CompoundAssignmentOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::CompoundAssignmentOperator) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::UnaryOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::UnaryOperator) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::UpdateOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::UpdateOperator) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::VariableDeclarationKind, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::VariableDeclarationKind) Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned char, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(unsigned char) Unexecuted instantiation: mozilla::detail::ResultImplementation<bool, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(bool) Unexecuted instantiation: mozilla::detail::ResultImplementation<double, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(double) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinVariant, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(js::frontend::BinVariant) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinTokenReaderBase::SkippableSubTree, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(js::frontend::BinTokenReaderBase::SkippableSubTree) Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned int, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(unsigned int) |
72 | 0 | explicit ResultImplementation(E& aErrorValue) : mStorage(&aErrorValue) {} Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::AssertedDeclaredKind, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(JS::Error&) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::BinaryOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(JS::Error&) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::CompoundAssignmentOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(JS::Error&) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::UnaryOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(JS::Error&) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::UpdateOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(JS::Error&) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::VariableDeclarationKind, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(JS::Error&) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::AssertedDeclaredKind, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(JS::Error&) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::BinaryOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(JS::Error&) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::CompoundAssignmentOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(JS::Error&) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::UnaryOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(JS::Error&) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::UpdateOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(JS::Error&) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::VariableDeclarationKind, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(JS::Error&) Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned char, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(JS::Error&) Unexecuted instantiation: mozilla::detail::ResultImplementation<bool, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(JS::Error&) Unexecuted instantiation: mozilla::detail::ResultImplementation<double, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(JS::Error&) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinVariant, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(JS::Error&) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinTokenReaderBase::SkippableSubTree, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(JS::Error&) Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned int, JS::Error&, (mozilla::detail::PackingStrategy)0>::ResultImplementation(JS::Error&) |
73 | | |
74 | 0 | bool isOk() const { return mStorage.template is<V>(); } Unexecuted instantiation: mozilla::detail::ResultImplementation<bool, JS::Error&, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::AssertedDeclaredKind, JS::Error&, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned int, JS::Error&, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::BinaryOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::CompoundAssignmentOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::VariableDeclarationKind, JS::Error&, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<double, JS::Error&, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::UnaryOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::UpdateOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinVariant, JS::Error&, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::AssertedDeclaredKind, JS::Error&, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::BinaryOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::CompoundAssignmentOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::VariableDeclarationKind, JS::Error&, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::UnaryOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::UpdateOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned char, JS::Error&, (mozilla::detail::PackingStrategy)0>::isOk() const |
75 | 0 | V unwrap() const { return mStorage.template as<V>(); } Unexecuted instantiation: mozilla::detail::ResultImplementation<bool, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::AssertedDeclaredKind, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned int, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::BinaryOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::CompoundAssignmentOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::VariableDeclarationKind, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<double, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::UnaryOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::UpdateOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinVariant, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::AssertedDeclaredKind, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::BinaryOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::CompoundAssignmentOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::VariableDeclarationKind, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::UnaryOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::UpdateOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned char, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrap() const |
76 | 0 | E& unwrapErr() const { return *mStorage.template as<E*>(); } Unexecuted instantiation: mozilla::detail::ResultImplementation<bool, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::AssertedDeclaredKind, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned int, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::BinaryOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::CompoundAssignmentOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::VariableDeclarationKind, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<double, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::UnaryOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::UpdateOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinVariant, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::AssertedDeclaredKind, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::BinaryOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::CompoundAssignmentOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::VariableDeclarationKind, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::UnaryOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::UpdateOperator, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned char, JS::Error&, (mozilla::detail::PackingStrategy)0>::unwrapErr() const |
77 | | }; |
78 | | |
79 | | /** |
80 | | * Specialization for when the success type is Ok (or another empty class) and |
81 | | * the error type is a reference. |
82 | | */ |
83 | | template <typename V, typename E> |
84 | | class ResultImplementation<V, E&, PackingStrategy::NullIsOk> |
85 | | { |
86 | | E* mErrorValue; |
87 | | |
88 | | public: |
89 | 0 | explicit ResultImplementation(V) : mErrorValue(nullptr) {} |
90 | 0 | explicit ResultImplementation(E& aErrorValue) : mErrorValue(&aErrorValue) {} |
91 | | |
92 | 0 | bool isOk() const { return mErrorValue == nullptr; } |
93 | | |
94 | 0 | V unwrap() const { return V(); } |
95 | 0 | E& unwrapErr() const { return *mErrorValue; } |
96 | | }; |
97 | | |
98 | | /** |
99 | | * Specialization for when the success type is Ok (or another empty class) and |
100 | | * the error type is a value type which can never have the value 0 (as |
101 | | * determined by UnusedZero<>). |
102 | | */ |
103 | | template <typename V, typename E> |
104 | | class ResultImplementation<V, E, PackingStrategy::NullIsOk> |
105 | | { |
106 | | static constexpr E NullValue = E(0); |
107 | | |
108 | | E mErrorValue; |
109 | | |
110 | | public: |
111 | 193 | explicit ResultImplementation(V) : mErrorValue(NullValue) {} |
112 | | explicit ResultImplementation(E aErrorValue) : mErrorValue(aErrorValue) |
113 | 15 | { |
114 | 15 | MOZ_ASSERT(aErrorValue != NullValue); |
115 | 15 | } |
116 | | |
117 | 202 | bool isOk() const { return mErrorValue == NullValue; } |
118 | | |
119 | | V unwrap() const { return V(); } |
120 | 6 | E unwrapErr() const { return mErrorValue; } |
121 | | }; |
122 | | |
123 | | |
124 | | /** |
125 | | * Specialization for when alignment permits using the least significant bit as |
126 | | * a tag bit. |
127 | | */ |
128 | | template <typename V, typename E> |
129 | | class ResultImplementation<V*, E&, PackingStrategy::LowBitTagIsError> |
130 | | { |
131 | | uintptr_t mBits; |
132 | | |
133 | | public: |
134 | | explicit ResultImplementation(V* aValue) |
135 | | : mBits(reinterpret_cast<uintptr_t>(aValue)) |
136 | 6.54M | { |
137 | 6.54M | MOZ_ASSERT((uintptr_t(aValue) % MOZ_ALIGNOF(V)) == 0, |
138 | 6.54M | "Result value pointers must not be misaligned"); |
139 | 6.54M | } Unexecuted instantiation: mozilla::detail::ResultImplementation<js::TypedObject*, JS::OOM&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(js::TypedObject*) mozilla::detail::ResultImplementation<js::NativeObject*, JS::OOM&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(js::NativeObject*) Line | Count | Source | 136 | 3.28M | { | 137 | 3.28M | MOZ_ASSERT((uintptr_t(aValue) % MOZ_ALIGNOF(V)) == 0, | 138 | 3.28M | "Result value pointers must not be misaligned"); | 139 | 3.28M | } |
mozilla::detail::ResultImplementation<JSFunction*, JS::OOM&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(JSFunction*) Line | Count | Source | 136 | 3.25M | { | 137 | 3.25M | MOZ_ASSERT((uintptr_t(aValue) % MOZ_ALIGNOF(V)) == 0, | 138 | 3.25M | "Result value pointers must not be misaligned"); | 139 | 3.25M | } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<js::ProxyObject*, JS::OOM&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(js::ProxyObject*) mozilla::detail::ResultImplementation<js::UnboxedObject*, JS::OOM&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(js::UnboxedObject*) Line | Count | Source | 136 | 2 | { | 137 | 2 | MOZ_ASSERT((uintptr_t(aValue) % MOZ_ALIGNOF(V)) == 0, | 138 | 2 | "Result value pointers must not be misaligned"); | 139 | 2 | } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::ParseNode*, JS::Error&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(js::frontend::ParseNode*) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::LexicalScopeNode*, JS::Error&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(js::frontend::LexicalScopeNode*) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::ListNode*, JS::Error&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(js::frontend::ListNode*) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::CaseClause*, JS::Error&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(js::frontend::CaseClause*) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::FunctionBox*, JS::Error&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(js::frontend::FunctionBox*) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinKind const*, JS::Error&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(js::frontend::BinKind const*) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinVariant const*, JS::Error&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(js::frontend::BinVariant const*) Unexecuted instantiation: mozilla::detail::ResultImplementation<JSAtom*, JS::Error&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(JSAtom*) |
140 | | explicit ResultImplementation(E& aErrorValue) |
141 | | : mBits(reinterpret_cast<uintptr_t>(&aErrorValue) | 1) |
142 | 0 | { |
143 | 0 | MOZ_ASSERT((uintptr_t(&aErrorValue) % MOZ_ALIGNOF(E)) == 0, |
144 | 0 | "Result errors must not be misaligned"); |
145 | 0 | } Unexecuted instantiation: mozilla::detail::ResultImplementation<js::TypedObject*, JS::OOM&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(JS::OOM&) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::NativeObject*, JS::OOM&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(JS::OOM&) Unexecuted instantiation: mozilla::detail::ResultImplementation<JSFunction*, JS::OOM&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(JS::OOM&) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::ProxyObject*, JS::OOM&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(JS::OOM&) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::UnboxedObject*, JS::OOM&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(JS::OOM&) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::ParseNode*, JS::Error&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(JS::Error&) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::LexicalScopeNode*, JS::Error&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(JS::Error&) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::ListNode*, JS::Error&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(JS::Error&) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::CaseClause*, JS::Error&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(JS::Error&) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::FunctionBox*, JS::Error&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(JS::Error&) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinKind const*, JS::Error&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(JS::Error&) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinVariant const*, JS::Error&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(JS::Error&) Unexecuted instantiation: mozilla::detail::ResultImplementation<JSAtom*, JS::Error&, (mozilla::detail::PackingStrategy)2>::ResultImplementation(JS::Error&) |
146 | | |
147 | 6.54M | bool isOk() const { return (mBits & 1) == 0; } mozilla::detail::ResultImplementation<js::NativeObject*, JS::OOM&, (mozilla::detail::PackingStrategy)2>::isOk() const Line | Count | Source | 147 | 3.28M | bool isOk() const { return (mBits & 1) == 0; } |
mozilla::detail::ResultImplementation<JSFunction*, JS::OOM&, (mozilla::detail::PackingStrategy)2>::isOk() const Line | Count | Source | 147 | 3.25M | bool isOk() const { return (mBits & 1) == 0; } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<js::TypedObject*, JS::OOM&, (mozilla::detail::PackingStrategy)2>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::ProxyObject*, JS::OOM&, (mozilla::detail::PackingStrategy)2>::isOk() const mozilla::detail::ResultImplementation<js::UnboxedObject*, JS::OOM&, (mozilla::detail::PackingStrategy)2>::isOk() const Line | Count | Source | 147 | 2 | bool isOk() const { return (mBits & 1) == 0; } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::ParseNode*, JS::Error&, (mozilla::detail::PackingStrategy)2>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::LexicalScopeNode*, JS::Error&, (mozilla::detail::PackingStrategy)2>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::ListNode*, JS::Error&, (mozilla::detail::PackingStrategy)2>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::CaseClause*, JS::Error&, (mozilla::detail::PackingStrategy)2>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<JSAtom*, JS::Error&, (mozilla::detail::PackingStrategy)2>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::FunctionBox*, JS::Error&, (mozilla::detail::PackingStrategy)2>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinKind const*, JS::Error&, (mozilla::detail::PackingStrategy)2>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinVariant const*, JS::Error&, (mozilla::detail::PackingStrategy)2>::isOk() const |
148 | | |
149 | 6.54M | V* unwrap() const { return reinterpret_cast<V*>(mBits); } mozilla::detail::ResultImplementation<js::NativeObject*, JS::OOM&, (mozilla::detail::PackingStrategy)2>::unwrap() const Line | Count | Source | 149 | 3.28M | V* unwrap() const { return reinterpret_cast<V*>(mBits); } |
mozilla::detail::ResultImplementation<JSFunction*, JS::OOM&, (mozilla::detail::PackingStrategy)2>::unwrap() const Line | Count | Source | 149 | 3.25M | V* unwrap() const { return reinterpret_cast<V*>(mBits); } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<js::TypedObject*, JS::OOM&, (mozilla::detail::PackingStrategy)2>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::ProxyObject*, JS::OOM&, (mozilla::detail::PackingStrategy)2>::unwrap() const mozilla::detail::ResultImplementation<js::UnboxedObject*, JS::OOM&, (mozilla::detail::PackingStrategy)2>::unwrap() const Line | Count | Source | 149 | 2 | V* unwrap() const { return reinterpret_cast<V*>(mBits); } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::ParseNode*, JS::Error&, (mozilla::detail::PackingStrategy)2>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::LexicalScopeNode*, JS::Error&, (mozilla::detail::PackingStrategy)2>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::ListNode*, JS::Error&, (mozilla::detail::PackingStrategy)2>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::CaseClause*, JS::Error&, (mozilla::detail::PackingStrategy)2>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<JSAtom*, JS::Error&, (mozilla::detail::PackingStrategy)2>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::FunctionBox*, JS::Error&, (mozilla::detail::PackingStrategy)2>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinKind const*, JS::Error&, (mozilla::detail::PackingStrategy)2>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinVariant const*, JS::Error&, (mozilla::detail::PackingStrategy)2>::unwrap() const |
150 | 0 | E& unwrapErr() const { return *reinterpret_cast<E*>(mBits ^ 1); } Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::ParseNode*, JS::Error&, (mozilla::detail::PackingStrategy)2>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::LexicalScopeNode*, JS::Error&, (mozilla::detail::PackingStrategy)2>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::ListNode*, JS::Error&, (mozilla::detail::PackingStrategy)2>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::CaseClause*, JS::Error&, (mozilla::detail::PackingStrategy)2>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<JSAtom*, JS::Error&, (mozilla::detail::PackingStrategy)2>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::FunctionBox*, JS::Error&, (mozilla::detail::PackingStrategy)2>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinKind const*, JS::Error&, (mozilla::detail::PackingStrategy)2>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::frontend::BinVariant const*, JS::Error&, (mozilla::detail::PackingStrategy)2>::unwrapErr() const |
151 | | }; |
152 | | |
153 | | // Return true if any of the struct can fit in a word. |
154 | | template<typename V, typename E> |
155 | | struct IsPackableVariant |
156 | | { |
157 | | struct VEbool { |
158 | | V v; |
159 | | E e; |
160 | | bool ok; |
161 | | }; |
162 | | struct EVbool { |
163 | | E e; |
164 | | V v; |
165 | | bool ok; |
166 | | }; |
167 | | |
168 | | using Impl = typename Conditional<sizeof(VEbool) <= sizeof(EVbool), |
169 | | VEbool, EVbool>::Type; |
170 | | |
171 | | static const bool value = sizeof(Impl) <= sizeof(uintptr_t); |
172 | | }; |
173 | | |
174 | | /** |
175 | | * Specialization for when both type are not using all the bytes, in order to |
176 | | * use one byte as a tag. |
177 | | */ |
178 | | template <typename V, typename E> |
179 | | class ResultImplementation<V, E, PackingStrategy::PackedVariant> |
180 | | { |
181 | | using Impl = typename IsPackableVariant<V, E>::Impl; |
182 | | Impl data; |
183 | | |
184 | | public: |
185 | | explicit ResultImplementation(V aValue) |
186 | 14.7k | { |
187 | 14.7k | data.v = aValue; |
188 | 14.7k | data.ok = true; |
189 | 14.7k | } mozilla::detail::ResultImplementation<mozilla::Ok, mozilla::CPUUsageWatcherError, (mozilla::detail::PackingStrategy)3>::ResultImplementation(mozilla::Ok) Line | Count | Source | 186 | 3 | { | 187 | 3 | data.v = aValue; | 188 | 3 | data.ok = true; | 189 | 3 | } |
mozilla::detail::ResultImplementation<mozilla::PrefValueKind, nsresult, (mozilla::detail::PackingStrategy)3>::ResultImplementation(mozilla::PrefValueKind) Line | Count | Source | 186 | 4.18k | { | 187 | 4.18k | data.v = aValue; | 188 | 4.18k | data.ok = true; | 189 | 4.18k | } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::Ok, mozilla::layers::BogusAnimation, (mozilla::detail::PackingStrategy)3>::ResultImplementation(mozilla::Ok) Unexecuted instantiation: mozilla::detail::ResultImplementation<nsIStyleSheetLinkingElement::Update, nsresult, (mozilla::detail::PackingStrategy)3>::ResultImplementation(nsIStyleSheetLinkingElement::Update) Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned char, nsresult, (mozilla::detail::PackingStrategy)3>::ResultImplementation(unsigned char) Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned short, nsresult, (mozilla::detail::PackingStrategy)3>::ResultImplementation(unsigned short) Unexecuted instantiation: mozilla::detail::ResultImplementation<bool, nsresult, (mozilla::detail::PackingStrategy)3>::ResultImplementation(bool) Unexecuted instantiation: mozilla::detail::ResultImplementation<short, nsresult, (mozilla::detail::PackingStrategy)3>::ResultImplementation(short) mozilla::detail::ResultImplementation<mozilla::Ok, js::jit::AbortReason, (mozilla::detail::PackingStrategy)3>::ResultImplementation(mozilla::Ok) Line | Count | Source | 186 | 2.51k | { | 187 | 2.51k | data.v = aValue; | 188 | 2.51k | data.ok = true; | 189 | 2.51k | } |
mozilla::detail::ResultImplementation<js::jit::IonBuilder::InliningStatus, js::jit::AbortReason, (mozilla::detail::PackingStrategy)3>::ResultImplementation(js::jit::IonBuilder::InliningStatus) Line | Count | Source | 186 | 84 | { | 187 | 84 | data.v = aValue; | 188 | 84 | data.ok = true; | 189 | 84 | } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<bool, js::jit::AbortReason, (mozilla::detail::PackingStrategy)3>::ResultImplementation(bool) mozilla::detail::ResultImplementation<js::jit::BarrierKind, js::jit::AbortReason, (mozilla::detail::PackingStrategy)3>::ResultImplementation(js::jit::BarrierKind) Line | Count | Source | 186 | 14 | { | 187 | 14 | data.v = aValue; | 188 | 14 | data.ok = true; | 189 | 14 | } |
mozilla::detail::ResultImplementation<mozilla::Ok, JS::TranscodeResult, (mozilla::detail::PackingStrategy)3>::ResultImplementation(mozilla::Ok) Line | Count | Source | 186 | 7.96k | { | 187 | 7.96k | data.v = aValue; | 188 | 7.96k | data.ok = true; | 189 | 7.96k | } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::Ok, js::frontend::ParseContext::BreakStatementError, (mozilla::detail::PackingStrategy)3>::ResultImplementation(mozilla::Ok) mozilla::detail::ResultImplementation<mozilla::Ok, js::frontend::ParseContext::ContinueStatementError, (mozilla::detail::PackingStrategy)3>::ResultImplementation(mozilla::Ok) Line | Count | Source | 186 | 24 | { | 187 | 24 | data.v = aValue; | 188 | 24 | data.ok = true; | 189 | 24 | } |
|
190 | | explicit ResultImplementation(E aErrorValue) |
191 | 0 | { |
192 | 0 | data.e = aErrorValue; |
193 | 0 | data.ok = false; |
194 | 0 | } Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::PrefValueKind, nsresult, (mozilla::detail::PackingStrategy)3>::ResultImplementation(nsresult) Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::Ok, mozilla::layers::BogusAnimation, (mozilla::detail::PackingStrategy)3>::ResultImplementation(mozilla::layers::BogusAnimation) Unexecuted instantiation: mozilla::detail::ResultImplementation<nsIStyleSheetLinkingElement::Update, nsresult, (mozilla::detail::PackingStrategy)3>::ResultImplementation(nsresult) Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned char, nsresult, (mozilla::detail::PackingStrategy)3>::ResultImplementation(nsresult) Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned short, nsresult, (mozilla::detail::PackingStrategy)3>::ResultImplementation(nsresult) Unexecuted instantiation: mozilla::detail::ResultImplementation<bool, nsresult, (mozilla::detail::PackingStrategy)3>::ResultImplementation(nsresult) Unexecuted instantiation: mozilla::detail::ResultImplementation<short, nsresult, (mozilla::detail::PackingStrategy)3>::ResultImplementation(nsresult) Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::Ok, js::jit::AbortReason, (mozilla::detail::PackingStrategy)3>::ResultImplementation(js::jit::AbortReason) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::jit::IonBuilder::InliningStatus, js::jit::AbortReason, (mozilla::detail::PackingStrategy)3>::ResultImplementation(js::jit::AbortReason) Unexecuted instantiation: mozilla::detail::ResultImplementation<bool, js::jit::AbortReason, (mozilla::detail::PackingStrategy)3>::ResultImplementation(js::jit::AbortReason) Unexecuted instantiation: mozilla::detail::ResultImplementation<js::jit::BarrierKind, js::jit::AbortReason, (mozilla::detail::PackingStrategy)3>::ResultImplementation(js::jit::AbortReason) Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::Ok, JS::TranscodeResult, (mozilla::detail::PackingStrategy)3>::ResultImplementation(JS::TranscodeResult) Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::Ok, js::frontend::ParseContext::BreakStatementError, (mozilla::detail::PackingStrategy)3>::ResultImplementation(js::frontend::ParseContext::BreakStatementError) Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::Ok, js::frontend::ParseContext::ContinueStatementError, (mozilla::detail::PackingStrategy)3>::ResultImplementation(js::frontend::ParseContext::ContinueStatementError) |
195 | | |
196 | 15.5k | bool isOk() const { return data.ok; } mozilla::detail::ResultImplementation<mozilla::PrefValueKind, nsresult, (mozilla::detail::PackingStrategy)3>::isOk() const Line | Count | Source | 196 | 4.18k | bool isOk() const { return data.ok; } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<nsIStyleSheetLinkingElement::Update, nsresult, (mozilla::detail::PackingStrategy)3>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::Ok, mozilla::layers::BogusAnimation, (mozilla::detail::PackingStrategy)3>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<bool, nsresult, (mozilla::detail::PackingStrategy)3>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned char, nsresult, (mozilla::detail::PackingStrategy)3>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned short, nsresult, (mozilla::detail::PackingStrategy)3>::isOk() const Unexecuted instantiation: mozilla::detail::ResultImplementation<short, nsresult, (mozilla::detail::PackingStrategy)3>::isOk() const mozilla::detail::ResultImplementation<mozilla::Ok, mozilla::CPUUsageWatcherError, (mozilla::detail::PackingStrategy)3>::isOk() const Line | Count | Source | 196 | 3 | bool isOk() const { return data.ok; } |
mozilla::detail::ResultImplementation<mozilla::Ok, js::jit::AbortReason, (mozilla::detail::PackingStrategy)3>::isOk() const Line | Count | Source | 196 | 3.28k | bool isOk() const { return data.ok; } |
mozilla::detail::ResultImplementation<js::jit::IonBuilder::InliningStatus, js::jit::AbortReason, (mozilla::detail::PackingStrategy)3>::isOk() const Line | Count | Source | 196 | 84 | bool isOk() const { return data.ok; } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<bool, js::jit::AbortReason, (mozilla::detail::PackingStrategy)3>::isOk() const mozilla::detail::ResultImplementation<js::jit::BarrierKind, js::jit::AbortReason, (mozilla::detail::PackingStrategy)3>::isOk() const Line | Count | Source | 196 | 14 | bool isOk() const { return data.ok; } |
mozilla::detail::ResultImplementation<mozilla::Ok, JS::TranscodeResult, (mozilla::detail::PackingStrategy)3>::isOk() const Line | Count | Source | 196 | 7.96k | bool isOk() const { return data.ok; } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::Ok, js::frontend::ParseContext::BreakStatementError, (mozilla::detail::PackingStrategy)3>::isOk() const mozilla::detail::ResultImplementation<mozilla::Ok, js::frontend::ParseContext::ContinueStatementError, (mozilla::detail::PackingStrategy)3>::isOk() const Line | Count | Source | 196 | 24 | bool isOk() const { return data.ok; } |
|
197 | | |
198 | 4.28k | V unwrap() const { return data.v; } mozilla::detail::ResultImplementation<mozilla::PrefValueKind, nsresult, (mozilla::detail::PackingStrategy)3>::unwrap() const Line | Count | Source | 198 | 4.18k | V unwrap() const { return data.v; } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<nsIStyleSheetLinkingElement::Update, nsresult, (mozilla::detail::PackingStrategy)3>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<bool, nsresult, (mozilla::detail::PackingStrategy)3>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned char, nsresult, (mozilla::detail::PackingStrategy)3>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned short, nsresult, (mozilla::detail::PackingStrategy)3>::unwrap() const Unexecuted instantiation: mozilla::detail::ResultImplementation<short, nsresult, (mozilla::detail::PackingStrategy)3>::unwrap() const mozilla::detail::ResultImplementation<js::jit::IonBuilder::InliningStatus, js::jit::AbortReason, (mozilla::detail::PackingStrategy)3>::unwrap() const Line | Count | Source | 198 | 84 | V unwrap() const { return data.v; } |
Unexecuted instantiation: mozilla::detail::ResultImplementation<bool, js::jit::AbortReason, (mozilla::detail::PackingStrategy)3>::unwrap() const mozilla::detail::ResultImplementation<js::jit::BarrierKind, js::jit::AbortReason, (mozilla::detail::PackingStrategy)3>::unwrap() const Line | Count | Source | 198 | 14 | V unwrap() const { return data.v; } |
|
199 | 0 | E unwrapErr() const { return data.e; } Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::PrefValueKind, nsresult, (mozilla::detail::PackingStrategy)3>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::Ok, mozilla::layers::BogusAnimation, (mozilla::detail::PackingStrategy)3>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<nsIStyleSheetLinkingElement::Update, nsresult, (mozilla::detail::PackingStrategy)3>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned char, nsresult, (mozilla::detail::PackingStrategy)3>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<unsigned short, nsresult, (mozilla::detail::PackingStrategy)3>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<short, nsresult, (mozilla::detail::PackingStrategy)3>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<bool, nsresult, (mozilla::detail::PackingStrategy)3>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::Ok, js::jit::AbortReason, (mozilla::detail::PackingStrategy)3>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::jit::IonBuilder::InliningStatus, js::jit::AbortReason, (mozilla::detail::PackingStrategy)3>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<bool, js::jit::AbortReason, (mozilla::detail::PackingStrategy)3>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<js::jit::BarrierKind, js::jit::AbortReason, (mozilla::detail::PackingStrategy)3>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::Ok, JS::TranscodeResult, (mozilla::detail::PackingStrategy)3>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::Ok, js::frontend::ParseContext::BreakStatementError, (mozilla::detail::PackingStrategy)3>::unwrapErr() const Unexecuted instantiation: mozilla::detail::ResultImplementation<mozilla::Ok, js::frontend::ParseContext::ContinueStatementError, (mozilla::detail::PackingStrategy)3>::unwrapErr() const |
200 | | }; |
201 | | |
202 | | // To use nullptr as a special value, we need the counter part to exclude zero |
203 | | // from its range of valid representations. |
204 | | // |
205 | | // By default assume that zero can be represented. |
206 | | template<typename T> |
207 | | struct UnusedZero |
208 | | { |
209 | | static const bool value = false; |
210 | | }; |
211 | | |
212 | | // References can't be null. |
213 | | template<typename T> |
214 | | struct UnusedZero<T&> |
215 | | { |
216 | | static const bool value = true; |
217 | | }; |
218 | | |
219 | | // A bit of help figuring out which of the above specializations to use. |
220 | | // |
221 | | // We begin by safely assuming types don't have a spare bit. |
222 | | template <typename T> struct HasFreeLSB { static const bool value = false; }; |
223 | | |
224 | | // The lowest bit of a properly-aligned pointer is always zero if the pointee |
225 | | // type is greater than byte-aligned. That bit is free to use if it's masked |
226 | | // out of such pointers before they're dereferenced. |
227 | | template <typename T> struct HasFreeLSB<T*> { |
228 | | static const bool value = (alignof(T) & 1) == 0; |
229 | | }; |
230 | | |
231 | | // We store references as pointers, so they have a free bit if a pointer would |
232 | | // have one. |
233 | | template <typename T> struct HasFreeLSB<T&> { |
234 | | static const bool value = HasFreeLSB<T*>::value; |
235 | | }; |
236 | | |
237 | | // Select one of the previous result implementation based on the properties of |
238 | | // the V and E types. |
239 | | template <typename V, typename E> |
240 | | struct SelectResultImpl |
241 | | { |
242 | | static const PackingStrategy value = |
243 | | (IsEmpty<V>::value && UnusedZero<E>::value) |
244 | | ? PackingStrategy::NullIsOk |
245 | | : (detail::HasFreeLSB<V>::value && detail::HasFreeLSB<E>::value) |
246 | | ? PackingStrategy::LowBitTagIsError |
247 | | : (IsDefaultConstructible<V>::value && IsDefaultConstructible<E>::value && |
248 | | IsPackableVariant<V, E>::value) |
249 | | ? PackingStrategy::PackedVariant |
250 | | : PackingStrategy::Variant; |
251 | | |
252 | | using Type = detail::ResultImplementation<V, E, value>; |
253 | | }; |
254 | | |
255 | | template <typename T> |
256 | | struct IsResult : FalseType { }; |
257 | | |
258 | | template <typename V, typename E> |
259 | | struct IsResult<Result<V, E>> : TrueType { }; |
260 | | |
261 | | } // namespace detail |
262 | | |
263 | | template <typename V, typename E> |
264 | | auto |
265 | | ToResult(Result<V, E>&& aValue) |
266 | | -> decltype(std::forward<Result<V, E>>(aValue)) |
267 | 10.4k | { |
268 | 10.4k | return std::forward<Result<V, E>>(aValue); |
269 | 10.4k | } _ZN7mozilla8ToResultINS_2OkE8nsresultEEDTclsr3stdE7forwardINS_6ResultIT_T0_EEEfp_EEOS6_ Line | Count | Source | 267 | 6 | { | 268 | 6 | return std::forward<Result<V, E>>(aValue); | 269 | 6 | } |
Unexecuted instantiation: _ZN7mozilla8ToResultINS_2OkENS_6layers14BogusAnimationEEEDTclsr3stdE7forwardINS_6ResultIT_T0_EEEfp_EEOS7_ Unexecuted instantiation: _ZN7mozilla8ToResultIh8nsresultEEDTclsr3stdE7forwardINS_6ResultIT_T0_EEEfp_EEOS5_ Unexecuted instantiation: _ZN7mozilla8ToResultIj8nsresultEEDTclsr3stdE7forwardINS_6ResultIT_T0_EEEfp_EEOS5_ Unexecuted instantiation: _ZN7mozilla8ToResultI6RefPtrINS_3dom7PromiseEE8nsresultEEDTclsr3stdE7forwardINS_6ResultIT_T0_EEEfp_EEOS9_ _ZN7mozilla8ToResultINS_2OkEN2js3jit11AbortReasonEEEDTclsr3stdE7forwardINS_6ResultIT_T0_EEEfp_EEOS8_ Line | Count | Source | 267 | 2.47k | { | 268 | 2.47k | return std::forward<Result<V, E>>(aValue); | 269 | 2.47k | } |
_ZN7mozilla8ToResultINS_2OkEN2JS15TranscodeResultEEEDTclsr3stdE7forwardINS_6ResultIT_T0_EEEfp_EEOS7_ Line | Count | Source | 267 | 7.95k | { | 268 | 7.95k | return std::forward<Result<V, E>>(aValue); | 269 | 7.95k | } |
Unexecuted instantiation: _ZN7mozilla8ToResultINS_2OkERN2JS5ErrorEEEDTclsr3stdE7forwardINS_6ResultIT_T0_EEEfp_EEOS8_ |
270 | | |
271 | | /** |
272 | | * Result<V, E> represents the outcome of an operation that can either succeed |
273 | | * or fail. It contains either a success value of type V or an error value of |
274 | | * type E. |
275 | | * |
276 | | * All Result methods are const, so results are basically immutable. |
277 | | * This is just like Variant<V, E> but with a slightly different API, and the |
278 | | * following cases are optimized so Result can be stored more efficiently: |
279 | | * |
280 | | * - If the success type is Ok (or another empty class) and the error type is a |
281 | | * reference, Result<V, E&> is guaranteed to be pointer-sized and all zero |
282 | | * bits on success. Do not change this representation! There is JIT code that |
283 | | * depends on it. |
284 | | * |
285 | | * - If the success type is a pointer type and the error type is a reference |
286 | | * type, and the least significant bit is unused for both types when stored |
287 | | * as a pointer (due to alignment rules), Result<V*, E&> is guaranteed to be |
288 | | * pointer-sized. In this case, we use the lowest bit as tag bit: 0 to |
289 | | * indicate the Result's bits are a V, 1 to indicate the Result's bits (with |
290 | | * the 1 masked out) encode an E*. |
291 | | * |
292 | | * The purpose of Result is to reduce the screwups caused by using `false` or |
293 | | * `nullptr` to indicate errors. |
294 | | * What screwups? See <https://bugzilla.mozilla.org/show_bug.cgi?id=912928> for |
295 | | * a partial list. |
296 | | */ |
297 | | template <typename V, typename E> |
298 | | class MOZ_MUST_USE_TYPE Result final |
299 | | { |
300 | | using Impl = typename detail::SelectResultImpl<V, E>::Type; |
301 | | |
302 | | Impl mImpl; |
303 | | |
304 | | public: |
305 | | /** |
306 | | * Create a success result. |
307 | | */ |
308 | 101M | MOZ_IMPLICIT Result(V aValue) : mImpl(aValue) { MOZ_ASSERT(isOk()); } mozilla::Result<unsigned int, nsresult>::Result(unsigned int) Line | Count | Source | 308 | 95.0M | MOZ_IMPLICIT Result(V aValue) : mImpl(aValue) { MOZ_ASSERT(isOk()); } |
mozilla::Result<mozilla::Ok, nsresult>::Result(mozilla::Ok) Line | Count | Source | 308 | 193 | MOZ_IMPLICIT Result(V aValue) : mImpl(aValue) { MOZ_ASSERT(isOk()); } |
mozilla::Result<mozilla::Ok, mozilla::CPUUsageWatcherError>::Result(mozilla::Ok) Line | Count | Source | 308 | 3 | MOZ_IMPLICIT Result(V aValue) : mImpl(aValue) { MOZ_ASSERT(isOk()); } |
Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsITimer>, nsresult>::Result(nsCOMPtr<nsITimer>) mozilla::Result<mozilla::PrefValueKind, nsresult>::Result(mozilla::PrefValueKind) Line | Count | Source | 308 | 4.18k | MOZ_IMPLICIT Result(V aValue) : mImpl(aValue) { MOZ_ASSERT(isOk()); } |
mozilla::Result<Pref*, nsresult>::Result(Pref*) Line | Count | Source | 308 | 3 | MOZ_IMPLICIT Result(V aValue) : mImpl(aValue) { MOZ_ASSERT(isOk()); } |
mozilla::Result<mozilla::Ok, char const*>::Result(mozilla::Ok) Line | Count | Source | 308 | 3 | MOZ_IMPLICIT Result(V aValue) : mImpl(aValue) { MOZ_ASSERT(isOk()); } |
Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsIRequest>, nsresult>::Result(nsCOMPtr<nsIRequest>) Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsIInputStream>, nsresult>::Result(nsCOMPtr<nsIInputStream>) mozilla::Result<nsTString<char>, nsresult>::Result(nsTString<char>) Line | Count | Source | 308 | 5 | MOZ_IMPLICIT Result(V aValue) : mImpl(aValue) { MOZ_ASSERT(isOk()); } |
mozilla::Result<nsCOMPtr<nsIFile>, nsresult>::Result(nsCOMPtr<nsIFile>) Line | Count | Source | 308 | 9 | MOZ_IMPLICIT Result(V aValue) : mImpl(aValue) { MOZ_ASSERT(isOk()); } |
Unexecuted instantiation: mozilla::Result<mozilla::URLPreloader::CacheKey, nsresult>::Result(mozilla::URLPreloader::CacheKey) mozilla::Result<mozilla::FileLocation, nsresult>::Result(mozilla::FileLocation) Line | Count | Source | 308 | 24 | MOZ_IMPLICIT Result(V aValue) : mImpl(aValue) { MOZ_ASSERT(isOk()); } |
mozilla::Result<nsTString<char> const, nsresult>::Result(nsTString<char>) Line | Count | Source | 308 | 48 | MOZ_IMPLICIT Result(V aValue) : mImpl(aValue) { MOZ_ASSERT(isOk()); } |
Unexecuted instantiation: mozilla::Result<mozilla::Ok, mozilla::layers::BogusAnimation>::Result(mozilla::Ok) Unexecuted instantiation: mozilla::Result<nsCSSValueSharedList*, mozilla::layers::BogusAnimation>::Result(nsCSSValueSharedList*) Unexecuted instantiation: mozilla::Result<nsIFrame*, nsresult>::Result(nsIFrame*) Unexecuted instantiation: mozilla::Result<nsIStyleSheetLinkingElement::Update, nsresult>::Result(nsIStyleSheetLinkingElement::Update) Unexecuted instantiation: mozilla::Result<mozilla::dom::MediaRecorder::Session::RunningState, nsresult>::Result(mozilla::dom::MediaRecorder::Session::RunningState) Unexecuted instantiation: mozilla::Result<unsigned char, nsresult>::Result(unsigned char) Unexecuted instantiation: mozilla::Result<unsigned short, nsresult>::Result(unsigned short) Unexecuted instantiation: mozilla::Result<unsigned long, nsresult>::Result(unsigned long) Unexecuted instantiation: mozilla::Result<bool, nsresult>::Result(bool) Unexecuted instantiation: mozilla::Result<short, nsresult>::Result(short) Unexecuted instantiation: mozilla::Result<int, nsresult>::Result(int) Unexecuted instantiation: mozilla::Result<mozilla::Result<mozilla::Ok, nsresult>, nsresult>::Result(mozilla::Result<mozilla::Ok, nsresult>) Unexecuted instantiation: mozilla::Result<long, nsresult>::Result(long) Unexecuted instantiation: mozilla::Result<RefPtr<mozilla::dom::Promise>, nsresult>::Result(RefPtr<mozilla::dom::Promise>) Unexecuted instantiation: mozilla::Result<nsTString<char16_t>, nsresult>::Result(nsTString<char16_t>) Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsIZipReaderCache>, nsresult>::Result(nsCOMPtr<nsIZipReaderCache>) mozilla::Result<mozilla::Ok, js::jit::AbortReason>::Result(mozilla::Ok) Line | Count | Source | 308 | 2.51k | MOZ_IMPLICIT Result(V aValue) : mImpl(aValue) { MOZ_ASSERT(isOk()); } |
mozilla::Result<js::jit::IonBuilder::InliningStatus, js::jit::AbortReason>::Result(js::jit::IonBuilder::InliningStatus) Line | Count | Source | 308 | 84 | MOZ_IMPLICIT Result(V aValue) : mImpl(aValue) { MOZ_ASSERT(isOk()); } |
Unexecuted instantiation: mozilla::Result<js::jit::MInstruction*, js::jit::AbortReason>::Result(js::jit::MInstruction*) Unexecuted instantiation: mozilla::Result<bool, js::jit::AbortReason>::Result(bool) mozilla::Result<js::jit::MCall*, js::jit::AbortReason>::Result(js::jit::MCall*) Line | Count | Source | 308 | 70 | MOZ_IMPLICIT Result(V aValue) : mImpl(aValue) { MOZ_ASSERT(isOk()); } |
mozilla::Result<js::jit::MBasicBlock*, js::jit::AbortReason>::Result(js::jit::MBasicBlock*) Line | Count | Source | 308 | 70 | MOZ_IMPLICIT Result(V aValue) : mImpl(aValue) { MOZ_ASSERT(isOk()); } |
Unexecuted instantiation: mozilla::Result<js::jit::MDefinition*, js::jit::AbortReason>::Result(js::jit::MDefinition*) Unexecuted instantiation: mozilla::Result<js::TypedObject*, JS::OOM&>::Result(js::TypedObject*) mozilla::Result<js::jit::BarrierKind, js::jit::AbortReason>::Result(js::jit::BarrierKind) Line | Count | Source | 308 | 14 | MOZ_IMPLICIT Result(V aValue) : mImpl(aValue) { MOZ_ASSERT(isOk()); } |
mozilla::Result<js::NativeObject*, JS::OOM&>::Result(js::NativeObject*) Line | Count | Source | 308 | 3.28M | MOZ_IMPLICIT Result(V aValue) : mImpl(aValue) { MOZ_ASSERT(isOk()); } |
mozilla::Result<mozilla::Ok, JS::TranscodeResult>::Result(mozilla::Ok) Line | Count | Source | 308 | 7.96k | MOZ_IMPLICIT Result(V aValue) : mImpl(aValue) { MOZ_ASSERT(isOk()); } |
mozilla::Result<JSFunction*, JS::OOM&>::Result(JSFunction*) Line | Count | Source | 308 | 3.25M | MOZ_IMPLICIT Result(V aValue) : mImpl(aValue) { MOZ_ASSERT(isOk()); } |
Unexecuted instantiation: mozilla::Result<mozilla::Ok, JS::Error&>::Result(mozilla::Ok) Unexecuted instantiation: mozilla::Result<js::ProxyObject*, JS::OOM&>::Result(js::ProxyObject*) mozilla::Result<js::UnboxedObject*, JS::OOM&>::Result(js::UnboxedObject*) Line | Count | Source | 308 | 2 | MOZ_IMPLICIT Result(V aValue) : mImpl(aValue) { MOZ_ASSERT(isOk()); } |
Unexecuted instantiation: mozilla::Result<mozilla::Ok, js::frontend::ParseContext::BreakStatementError>::Result(mozilla::Ok) mozilla::Result<mozilla::Ok, js::frontend::ParseContext::ContinueStatementError>::Result(mozilla::Ok) Line | Count | Source | 308 | 24 | MOZ_IMPLICIT Result(V aValue) : mImpl(aValue) { MOZ_ASSERT(isOk()); } |
Unexecuted instantiation: mozilla::Result<js::frontend::ParseNode*, JS::Error&>::Result(js::frontend::ParseNode*) Unexecuted instantiation: mozilla::Result<js::frontend::LexicalScopeNode*, JS::Error&>::Result(js::frontend::LexicalScopeNode*) Unexecuted instantiation: mozilla::Result<js::frontend::ListNode*, JS::Error&>::Result(js::frontend::ListNode*) Unexecuted instantiation: mozilla::Result<js::frontend::CaseClause*, JS::Error&>::Result(js::frontend::CaseClause*) Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::AssertedDeclaredKind, JS::Error&>::Result(js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::AssertedDeclaredKind) Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::BinaryOperator, JS::Error&>::Result(js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::BinaryOperator) Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::CompoundAssignmentOperator, JS::Error&>::Result(js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::CompoundAssignmentOperator) Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::UnaryOperator, JS::Error&>::Result(js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::UnaryOperator) Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::UpdateOperator, JS::Error&>::Result(js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::UpdateOperator) Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::VariableDeclarationKind, JS::Error&>::Result(js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::VariableDeclarationKind) Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::AssertedDeclaredKind, JS::Error&>::Result(js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::AssertedDeclaredKind) Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::BinaryOperator, JS::Error&>::Result(js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::BinaryOperator) Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::CompoundAssignmentOperator, JS::Error&>::Result(js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::CompoundAssignmentOperator) Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::UnaryOperator, JS::Error&>::Result(js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::UnaryOperator) Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::UpdateOperator, JS::Error&>::Result(js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::UpdateOperator) Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::VariableDeclarationKind, JS::Error&>::Result(js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::VariableDeclarationKind) Unexecuted instantiation: mozilla::Result<js::frontend::FunctionBox*, JS::Error&>::Result(js::frontend::FunctionBox*) Unexecuted instantiation: mozilla::Result<js::frontend::BinKind const*, JS::Error&>::Result(js::frontend::BinKind const*) Unexecuted instantiation: mozilla::Result<js::frontend::BinVariant const*, JS::Error&>::Result(js::frontend::BinVariant const*) Unexecuted instantiation: mozilla::Result<unsigned char, JS::Error&>::Result(unsigned char) Unexecuted instantiation: mozilla::Result<bool, JS::Error&>::Result(bool) Unexecuted instantiation: mozilla::Result<double, JS::Error&>::Result(double) Unexecuted instantiation: mozilla::Result<JSAtom*, JS::Error&>::Result(JSAtom*) Unexecuted instantiation: mozilla::Result<js::frontend::BinVariant, JS::Error&>::Result(js::frontend::BinVariant) Unexecuted instantiation: mozilla::Result<js::frontend::BinTokenReaderBase::SkippableSubTree, JS::Error&>::Result(js::frontend::BinTokenReaderBase::SkippableSubTree) Unexecuted instantiation: mozilla::Result<unsigned int, JS::Error&>::Result(unsigned int) |
309 | | |
310 | | /** |
311 | | * Create an error result. |
312 | | */ |
313 | 0 | explicit Result(E aErrorValue) : mImpl(aErrorValue) { MOZ_ASSERT(isErr()); } Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsIRequest>, nsresult>::Result(nsresult) Unexecuted instantiation: mozilla::Result<mozilla::Result<mozilla::Ok, nsresult>, nsresult>::Result(nsresult) Unexecuted instantiation: mozilla::Result<unsigned int, nsresult>::Result(nsresult) |
314 | | |
315 | | /** |
316 | | * Implementation detail of MOZ_TRY(). |
317 | | * Create an error result from another error result. |
318 | | */ |
319 | | template <typename E2> |
320 | | MOZ_IMPLICIT Result(const GenericErrorResult<E2>& aErrorResult) |
321 | | : mImpl(aErrorResult.mErrorValue) |
322 | 18 | { |
323 | 18 | static_assert(mozilla::IsConvertible<E2, E>::value, |
324 | 18 | "E2 must be convertible to E"); |
325 | 18 | MOZ_ASSERT(isErr()); |
326 | 18 | } Unexecuted instantiation: mozilla::Result<unsigned int, nsresult>::Result<nsresult const&>(mozilla::GenericErrorResult<nsresult const&> const&) Unexecuted instantiation: mozilla::Result<mozilla::Ok, nsresult>::Result<nsresult&>(mozilla::GenericErrorResult<nsresult&> const&) Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsITimer>, nsresult>::Result<nsresult>(mozilla::GenericErrorResult<nsresult> const&) Unexecuted instantiation: mozilla::Result<mozilla::PrefValueKind, nsresult>::Result<nsresult const&>(mozilla::GenericErrorResult<nsresult const&> const&) Unexecuted instantiation: mozilla::Result<Pref*, nsresult>::Result<nsresult const&>(mozilla::GenericErrorResult<nsresult const&> const&) Unexecuted instantiation: mozilla::Result<mozilla::Ok, char const*>::Result<char const (&) [30]>(mozilla::GenericErrorResult<char const (&) [30]> const&) Unexecuted instantiation: mozilla::Result<mozilla::Ok, char const*>::Result<char const (&) [29]>(mozilla::GenericErrorResult<char const (&) [29]> const&) Unexecuted instantiation: mozilla::Result<mozilla::Ok, char const*>::Result<char const (&) [42]>(mozilla::GenericErrorResult<char const (&) [42]> const&) Unexecuted instantiation: mozilla::Result<mozilla::Ok, char const*>::Result<char const (&) [36]>(mozilla::GenericErrorResult<char const (&) [36]> const&) Unexecuted instantiation: mozilla::Result<mozilla::Ok, char const*>::Result<char const (&) [59]>(mozilla::GenericErrorResult<char const (&) [59]> const&) Unexecuted instantiation: mozilla::Result<mozilla::Ok, char const*>::Result<char const (&) [32]>(mozilla::GenericErrorResult<char const (&) [32]> const&) Unexecuted instantiation: mozilla::Result<mozilla::Ok, char const*>::Result<char const (&) [54]>(mozilla::GenericErrorResult<char const (&) [54]> const&) mozilla::Result<mozilla::Ok, nsresult>::Result<nsresult>(mozilla::GenericErrorResult<nsresult> const&) Line | Count | Source | 322 | 9 | { | 323 | 9 | static_assert(mozilla::IsConvertible<E2, E>::value, | 324 | 9 | "E2 must be convertible to E"); | 325 | 9 | MOZ_ASSERT(isErr()); | 326 | 9 | } |
Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsIRequest>, nsresult>::Result<nsresult>(mozilla::GenericErrorResult<nsresult> const&) mozilla::Result<mozilla::Ok, nsresult>::Result<nsresult const&>(mozilla::GenericErrorResult<nsresult const&> const&) Line | Count | Source | 322 | 6 | { | 323 | 6 | static_assert(mozilla::IsConvertible<E2, E>::value, | 324 | 6 | "E2 must be convertible to E"); | 325 | 6 | MOZ_ASSERT(isErr()); | 326 | 6 | } |
Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsIInputStream>, nsresult>::Result<nsresult>(mozilla::GenericErrorResult<nsresult> const&) Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsIInputStream>, nsresult>::Result<nsresult const&>(mozilla::GenericErrorResult<nsresult const&> const&) Unexecuted instantiation: mozilla::Result<nsTString<char>, nsresult>::Result<nsresult>(mozilla::GenericErrorResult<nsresult> const&) Unexecuted instantiation: mozilla::Result<nsTString<char>, nsresult>::Result<nsresult const&>(mozilla::GenericErrorResult<nsresult const&> const&) mozilla::Result<nsCOMPtr<nsIFile>, nsresult>::Result<nsresult const&>(mozilla::GenericErrorResult<nsresult const&> const&) Line | Count | Source | 322 | 3 | { | 323 | 3 | static_assert(mozilla::IsConvertible<E2, E>::value, | 324 | 3 | "E2 must be convertible to E"); | 325 | 3 | MOZ_ASSERT(isErr()); | 326 | 3 | } |
Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsIFile>, nsresult>::Result<nsresult>(mozilla::GenericErrorResult<nsresult> const&) Unexecuted instantiation: mozilla::Result<nsTString<char> const, nsresult>::Result<nsresult>(mozilla::GenericErrorResult<nsresult> const&) Unexecuted instantiation: mozilla::Result<nsTString<char> const, nsresult>::Result<nsresult const&>(mozilla::GenericErrorResult<nsresult const&> const&) Unexecuted instantiation: mozilla::Result<mozilla::URLPreloader::CacheKey, nsresult>::Result<nsresult>(mozilla::GenericErrorResult<nsresult> const&) Unexecuted instantiation: mozilla::Result<mozilla::URLPreloader::CacheKey, nsresult>::Result<nsresult const&>(mozilla::GenericErrorResult<nsresult const&> const&) Unexecuted instantiation: mozilla::Result<mozilla::FileLocation, nsresult>::Result<nsresult>(mozilla::GenericErrorResult<nsresult> const&) Unexecuted instantiation: mozilla::Result<nsTString<char> const, nsresult>::Result<nsresult&>(mozilla::GenericErrorResult<nsresult&> const&) Unexecuted instantiation: mozilla::Result<mozilla::Ok, mozilla::layers::BogusAnimation>::Result<mozilla::layers::BogusAnimation>(mozilla::GenericErrorResult<mozilla::layers::BogusAnimation> const&) Unexecuted instantiation: mozilla::Result<nsCSSValueSharedList*, mozilla::layers::BogusAnimation>::Result<mozilla::layers::BogusAnimation>(mozilla::GenericErrorResult<mozilla::layers::BogusAnimation> const&) Unexecuted instantiation: mozilla::Result<nsIFrame*, nsresult>::Result<nsresult const&>(mozilla::GenericErrorResult<nsresult const&> const&) Unexecuted instantiation: mozilla::Result<nsIStyleSheetLinkingElement::Update, nsresult>::Result<nsresult const&>(mozilla::GenericErrorResult<nsresult const&> const&) Unexecuted instantiation: mozilla::Result<nsIStyleSheetLinkingElement::Update, nsresult>::Result<nsresult&>(mozilla::GenericErrorResult<nsresult&> const&) Unexecuted instantiation: mozilla::Result<unsigned int, nsresult>::Result<nsresult&>(mozilla::GenericErrorResult<nsresult&> const&) Unexecuted instantiation: mozilla::Result<mozilla::dom::MediaRecorder::Session::RunningState, nsresult>::Result<nsresult&>(mozilla::GenericErrorResult<nsresult&> const&) Unexecuted instantiation: mozilla::Result<unsigned char, nsresult>::Result<nsresult const&>(mozilla::GenericErrorResult<nsresult const&> const&) Unexecuted instantiation: mozilla::Result<unsigned short, nsresult>::Result<nsresult const&>(mozilla::GenericErrorResult<nsresult const&> const&) Unexecuted instantiation: mozilla::Result<unsigned long, nsresult>::Result<nsresult const&>(mozilla::GenericErrorResult<nsresult const&> const&) Unexecuted instantiation: mozilla::Result<bool, nsresult>::Result<nsresult>(mozilla::GenericErrorResult<nsresult> const&) Unexecuted instantiation: mozilla::Result<short, nsresult>::Result<nsresult const&>(mozilla::GenericErrorResult<nsresult const&> const&) Unexecuted instantiation: mozilla::Result<int, nsresult>::Result<nsresult const&>(mozilla::GenericErrorResult<nsresult const&> const&) Unexecuted instantiation: mozilla::Result<long, nsresult>::Result<nsresult const&>(mozilla::GenericErrorResult<nsresult const&> const&) Unexecuted instantiation: mozilla::Result<RefPtr<mozilla::dom::Promise>, nsresult>::Result<nsresult>(mozilla::GenericErrorResult<nsresult> const&) Unexecuted instantiation: mozilla::Result<RefPtr<mozilla::dom::Promise>, nsresult>::Result<nsresult const&>(mozilla::GenericErrorResult<nsresult const&> const&) Unexecuted instantiation: mozilla::Result<nsTString<char16_t>, nsresult>::Result<nsresult>(mozilla::GenericErrorResult<nsresult> const&) Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsIRequest>, nsresult>::Result<nsresult&>(mozilla::GenericErrorResult<nsresult&> const&) Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsIZipReaderCache>, nsresult>::Result<nsresult const&>(mozilla::GenericErrorResult<nsresult const&> const&) Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsIZipReaderCache>, nsresult>::Result<nsresult>(mozilla::GenericErrorResult<nsresult> const&) Unexecuted instantiation: mozilla::Result<mozilla::FileLocation, nsresult>::Result<nsresult const&>(mozilla::GenericErrorResult<nsresult const&> const&) Unexecuted instantiation: mozilla::Result<mozilla::Ok, js::jit::AbortReason>::Result<js::jit::AbortReason>(mozilla::GenericErrorResult<js::jit::AbortReason> const&) Unexecuted instantiation: mozilla::Result<js::jit::IonBuilder::InliningStatus, js::jit::AbortReason>::Result<js::jit::AbortReason>(mozilla::GenericErrorResult<js::jit::AbortReason> const&) Unexecuted instantiation: mozilla::Result<js::jit::MInstruction*, js::jit::AbortReason>::Result<js::jit::AbortReason>(mozilla::GenericErrorResult<js::jit::AbortReason> const&) Unexecuted instantiation: mozilla::Result<bool, js::jit::AbortReason>::Result<js::jit::AbortReason>(mozilla::GenericErrorResult<js::jit::AbortReason> const&) Unexecuted instantiation: mozilla::Result<js::jit::MCall*, js::jit::AbortReason>::Result<js::jit::AbortReason>(mozilla::GenericErrorResult<js::jit::AbortReason> const&) Unexecuted instantiation: mozilla::Result<js::jit::MBasicBlock*, js::jit::AbortReason>::Result<js::jit::AbortReason>(mozilla::GenericErrorResult<js::jit::AbortReason> const&) Unexecuted instantiation: mozilla::Result<js::jit::MDefinition*, js::jit::AbortReason>::Result<js::jit::AbortReason>(mozilla::GenericErrorResult<js::jit::AbortReason> const&) Unexecuted instantiation: mozilla::Result<js::TypedObject*, JS::OOM&>::Result<JS::OOM&>(mozilla::GenericErrorResult<JS::OOM&> const&) Unexecuted instantiation: mozilla::Result<js::jit::BarrierKind, js::jit::AbortReason>::Result<js::jit::AbortReason>(mozilla::GenericErrorResult<js::jit::AbortReason> const&) Unexecuted instantiation: mozilla::Result<js::NativeObject*, JS::OOM&>::Result<JS::OOM&>(mozilla::GenericErrorResult<JS::OOM&> const&) Unexecuted instantiation: mozilla::Result<mozilla::Ok, JS::TranscodeResult>::Result<JS::TranscodeResult&>(mozilla::GenericErrorResult<JS::TranscodeResult&> const&) Unexecuted instantiation: mozilla::Result<mozilla::Ok, JS::TranscodeResult>::Result<JS::TranscodeResult>(mozilla::GenericErrorResult<JS::TranscodeResult> const&) Unexecuted instantiation: mozilla::Result<JSFunction*, JS::OOM&>::Result<JS::OOM&>(mozilla::GenericErrorResult<JS::OOM&> const&) Unexecuted instantiation: mozilla::Result<mozilla::Ok, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) Unexecuted instantiation: mozilla::Result<js::ProxyObject*, JS::OOM&>::Result<JS::OOM&>(mozilla::GenericErrorResult<JS::OOM&> const&) Unexecuted instantiation: mozilla::Result<js::UnboxedObject*, JS::OOM&>::Result<JS::OOM&>(mozilla::GenericErrorResult<JS::OOM&> const&) Unexecuted instantiation: mozilla::Result<mozilla::Ok, js::frontend::ParseContext::BreakStatementError>::Result<js::frontend::ParseContext::BreakStatementError>(mozilla::GenericErrorResult<js::frontend::ParseContext::BreakStatementError> const&) Unexecuted instantiation: mozilla::Result<mozilla::Ok, js::frontend::ParseContext::ContinueStatementError>::Result<js::frontend::ParseContext::ContinueStatementError>(mozilla::GenericErrorResult<js::frontend::ParseContext::ContinueStatementError> const&) Unexecuted instantiation: mozilla::Result<js::frontend::ParseNode*, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) Unexecuted instantiation: mozilla::Result<js::frontend::LexicalScopeNode*, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) Unexecuted instantiation: mozilla::Result<js::frontend::ListNode*, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) Unexecuted instantiation: mozilla::Result<js::frontend::CaseClause*, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::AssertedDeclaredKind, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::BinaryOperator, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::CompoundAssignmentOperator, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::UnaryOperator, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::UpdateOperator, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::VariableDeclarationKind, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::AssertedDeclaredKind, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::BinaryOperator, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::CompoundAssignmentOperator, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::UnaryOperator, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::UpdateOperator, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::VariableDeclarationKind, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) Unexecuted instantiation: mozilla::Result<js::frontend::FunctionBox*, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) Unexecuted instantiation: mozilla::Result<js::frontend::BinKind const*, JS::Error&>::Result<JS::OOM&>(mozilla::GenericErrorResult<JS::OOM&> const&) Unexecuted instantiation: mozilla::Result<js::frontend::BinVariant const*, JS::Error&>::Result<JS::OOM&>(mozilla::GenericErrorResult<JS::OOM&> const&) Unexecuted instantiation: mozilla::Result<unsigned char, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) Unexecuted instantiation: mozilla::Result<bool, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) Unexecuted instantiation: mozilla::Result<double, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) Unexecuted instantiation: mozilla::Result<JSAtom*, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) Unexecuted instantiation: mozilla::Result<js::frontend::BinVariant, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) Unexecuted instantiation: mozilla::Result<js::frontend::BinTokenReaderBase::SkippableSubTree, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) Unexecuted instantiation: mozilla::Result<unsigned int, JS::Error&>::Result<JS::Error&>(mozilla::GenericErrorResult<JS::Error&> const&) |
327 | | |
328 | 0 | Result(const Result&) = default; Unexecuted instantiation: mozilla::Result<unsigned int, nsresult>::Result(mozilla::Result<unsigned int, nsresult> const&) Unexecuted instantiation: mozilla::Result<RefPtr<mozilla::dom::Promise>, nsresult>::Result(mozilla::Result<RefPtr<mozilla::dom::Promise>, nsresult> const&) |
329 | 0 | Result& operator=(const Result&) = default; Unexecuted instantiation: mozilla::Result<mozilla::dom::MediaRecorder::Session::RunningState, nsresult>::operator=(mozilla::Result<mozilla::dom::MediaRecorder::Session::RunningState, nsresult> const&) Unexecuted instantiation: mozilla::Result<unsigned int, nsresult>::operator=(mozilla::Result<unsigned int, nsresult> const&) |
330 | | |
331 | | /** True if this Result is a success result. */ |
332 | 3.18M | bool isOk() const { return mImpl.isOk(); } mozilla::Result<unsigned int, nsresult>::isOk() const Line | Count | Source | 332 | 3.18M | bool isOk() const { return mImpl.isOk(); } |
mozilla::Result<nsTString<char> const, nsresult>::isOk() const Line | Count | Source | 332 | 12 | bool isOk() const { return mImpl.isOk(); } |
Unexecuted instantiation: mozilla::Result<Pref*, nsresult>::isOk() const Unexecuted instantiation: mozilla::Result<mozilla::Ok, char const*>::isOk() const mozilla::Result<mozilla::Ok, nsresult>::isOk() const Line | Count | Source | 332 | 3 | bool isOk() const { return mImpl.isOk(); } |
Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsIInputStream>, nsresult>::isOk() const Unexecuted instantiation: mozilla::Result<nsIStyleSheetLinkingElement::Update, nsresult>::isOk() const Unexecuted instantiation: mozilla::Result<nsCSSValueSharedList*, mozilla::layers::BogusAnimation>::isOk() const Unexecuted instantiation: mozilla::Result<mozilla::dom::MediaRecorder::Session::RunningState, nsresult>::isOk() const Unexecuted instantiation: mozilla::Result<bool, nsresult>::isOk() const Unexecuted instantiation: mozilla::Result<unsigned char, nsresult>::isOk() const Unexecuted instantiation: mozilla::Result<unsigned short, nsresult>::isOk() const Unexecuted instantiation: mozilla::Result<long, nsresult>::isOk() const Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsITimer>, nsresult>::isOk() const Unexecuted instantiation: mozilla::Result<nsTString<char16_t>, nsresult>::isOk() const Unexecuted instantiation: mozilla::Result<RefPtr<mozilla::dom::Promise>, nsresult>::isOk() const Unexecuted instantiation: mozilla::Result<nsTString<char>, nsresult>::isOk() const Unexecuted instantiation: mozilla::Result<js::NativeObject*, JS::OOM&>::isOk() const Unexecuted instantiation: mozilla::Result<mozilla::Ok, JS::Error&>::isOk() const Unexecuted instantiation: mozilla::Result<mozilla::Ok, JS::TranscodeResult>::isOk() const Unexecuted instantiation: mozilla::Result<JSFunction*, JS::OOM&>::isOk() const Unexecuted instantiation: mozilla::Result<js::TypedObject*, JS::OOM&>::isOk() const Unexecuted instantiation: mozilla::Result<js::ProxyObject*, JS::OOM&>::isOk() const Unexecuted instantiation: mozilla::Result<js::UnboxedObject*, JS::OOM&>::isOk() const |
333 | | |
334 | | /** True if this Result is an error result. */ |
335 | 98.4M | bool isErr() const { return !mImpl.isOk(); } mozilla::Result<unsigned int, nsresult>::isErr() const Line | Count | Source | 335 | 91.8M | bool isErr() const { return !mImpl.isOk(); } |
mozilla::Result<nsTString<char> const, nsresult>::isErr() const Line | Count | Source | 335 | 36 | bool isErr() const { return !mImpl.isOk(); } |
mozilla::Result<mozilla::Ok, nsresult>::isErr() const Line | Count | Source | 335 | 199 | bool isErr() const { return !mImpl.isOk(); } |
mozilla::Result<mozilla::PrefValueKind, nsresult>::isErr() const Line | Count | Source | 335 | 4.18k | bool isErr() const { return !mImpl.isOk(); } |
mozilla::Result<mozilla::Ok, char const*>::isErr() const Line | Count | Source | 335 | 3 | bool isErr() const { return !mImpl.isOk(); } |
mozilla::Result<Pref*, nsresult>::isErr() const Line | Count | Source | 335 | 3 | bool isErr() const { return !mImpl.isOk(); } |
Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsIInputStream>, nsresult>::isErr() const Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsIRequest>, nsresult>::isErr() const mozilla::Result<nsTString<char>, nsresult>::isErr() const Line | Count | Source | 335 | 5 | bool isErr() const { return !mImpl.isOk(); } |
mozilla::Result<nsCOMPtr<nsIFile>, nsresult>::isErr() const Line | Count | Source | 335 | 12 | bool isErr() const { return !mImpl.isOk(); } |
Unexecuted instantiation: mozilla::Result<mozilla::URLPreloader::CacheKey, nsresult>::isErr() const mozilla::Result<mozilla::FileLocation, nsresult>::isErr() const Line | Count | Source | 335 | 24 | bool isErr() const { return !mImpl.isOk(); } |
Unexecuted instantiation: mozilla::Result<mozilla::Ok, mozilla::layers::BogusAnimation>::isErr() const Unexecuted instantiation: mozilla::Result<nsIFrame*, nsresult>::isErr() const Unexecuted instantiation: mozilla::Result<nsIStyleSheetLinkingElement::Update, nsresult>::isErr() const Unexecuted instantiation: mozilla::Result<mozilla::dom::MediaRecorder::Session::RunningState, nsresult>::isErr() const Unexecuted instantiation: mozilla::Result<unsigned char, nsresult>::isErr() const Unexecuted instantiation: mozilla::Result<unsigned short, nsresult>::isErr() const Unexecuted instantiation: mozilla::Result<unsigned long, nsresult>::isErr() const Unexecuted instantiation: mozilla::Result<short, nsresult>::isErr() const Unexecuted instantiation: mozilla::Result<int, nsresult>::isErr() const Unexecuted instantiation: mozilla::Result<long, nsresult>::isErr() const Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsITimer>, nsresult>::isErr() const mozilla::Result<mozilla::Ok, mozilla::CPUUsageWatcherError>::isErr() const Line | Count | Source | 335 | 3 | bool isErr() const { return !mImpl.isOk(); } |
Unexecuted instantiation: mozilla::Result<nsTString<char16_t>, nsresult>::isErr() const Unexecuted instantiation: mozilla::Result<RefPtr<mozilla::dom::Promise>, nsresult>::isErr() const Unexecuted instantiation: mozilla::Result<bool, nsresult>::isErr() const Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsIZipReaderCache>, nsresult>::isErr() const mozilla::Result<js::NativeObject*, JS::OOM&>::isErr() const Line | Count | Source | 335 | 3.28M | bool isErr() const { return !mImpl.isOk(); } |
mozilla::Result<mozilla::Ok, js::jit::AbortReason>::isErr() const Line | Count | Source | 335 | 3.28k | bool isErr() const { return !mImpl.isOk(); } |
mozilla::Result<js::jit::MBasicBlock*, js::jit::AbortReason>::isErr() const Line | Count | Source | 335 | 70 | bool isErr() const { return !mImpl.isOk(); } |
Unexecuted instantiation: mozilla::Result<js::jit::MInstruction*, js::jit::AbortReason>::isErr() const mozilla::Result<js::jit::IonBuilder::InliningStatus, js::jit::AbortReason>::isErr() const Line | Count | Source | 335 | 84 | bool isErr() const { return !mImpl.isOk(); } |
Unexecuted instantiation: mozilla::Result<bool, js::jit::AbortReason>::isErr() const mozilla::Result<js::jit::MCall*, js::jit::AbortReason>::isErr() const Line | Count | Source | 335 | 70 | bool isErr() const { return !mImpl.isOk(); } |
Unexecuted instantiation: mozilla::Result<js::jit::MDefinition*, js::jit::AbortReason>::isErr() const mozilla::Result<js::jit::BarrierKind, js::jit::AbortReason>::isErr() const Line | Count | Source | 335 | 14 | bool isErr() const { return !mImpl.isOk(); } |
mozilla::Result<mozilla::Ok, JS::TranscodeResult>::isErr() const Line | Count | Source | 335 | 7.96k | bool isErr() const { return !mImpl.isOk(); } |
Unexecuted instantiation: mozilla::Result<mozilla::Ok, JS::Error&>::isErr() const mozilla::Result<JSFunction*, JS::OOM&>::isErr() const Line | Count | Source | 335 | 3.25M | bool isErr() const { return !mImpl.isOk(); } |
Unexecuted instantiation: mozilla::Result<js::TypedObject*, JS::OOM&>::isErr() const Unexecuted instantiation: mozilla::Result<js::ProxyObject*, JS::OOM&>::isErr() const mozilla::Result<js::UnboxedObject*, JS::OOM&>::isErr() const Line | Count | Source | 335 | 2 | bool isErr() const { return !mImpl.isOk(); } |
Unexecuted instantiation: mozilla::Result<js::frontend::ParseNode*, JS::Error&>::isErr() const Unexecuted instantiation: mozilla::Result<js::frontend::LexicalScopeNode*, JS::Error&>::isErr() const Unexecuted instantiation: mozilla::Result<js::frontend::ListNode*, JS::Error&>::isErr() const Unexecuted instantiation: mozilla::Result<js::frontend::CaseClause*, JS::Error&>::isErr() const Unexecuted instantiation: mozilla::Result<bool, JS::Error&>::isErr() const Unexecuted instantiation: mozilla::Result<JSAtom*, JS::Error&>::isErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::AssertedDeclaredKind, JS::Error&>::isErr() const Unexecuted instantiation: mozilla::Result<unsigned int, JS::Error&>::isErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::BinaryOperator, JS::Error&>::isErr() const Unexecuted instantiation: mozilla::Result<mozilla::Ok, js::frontend::ParseContext::BreakStatementError>::isErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::CompoundAssignmentOperator, JS::Error&>::isErr() const mozilla::Result<mozilla::Ok, js::frontend::ParseContext::ContinueStatementError>::isErr() const Line | Count | Source | 335 | 24 | bool isErr() const { return !mImpl.isOk(); } |
Unexecuted instantiation: mozilla::Result<js::frontend::FunctionBox*, JS::Error&>::isErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::VariableDeclarationKind, JS::Error&>::isErr() const Unexecuted instantiation: mozilla::Result<double, JS::Error&>::isErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::UnaryOperator, JS::Error&>::isErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::UpdateOperator, JS::Error&>::isErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinVariant, JS::Error&>::isErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::AssertedDeclaredKind, JS::Error&>::isErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::BinaryOperator, JS::Error&>::isErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::CompoundAssignmentOperator, JS::Error&>::isErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::VariableDeclarationKind, JS::Error&>::isErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::UnaryOperator, JS::Error&>::isErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::UpdateOperator, JS::Error&>::isErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinKind const*, JS::Error&>::isErr() const Unexecuted instantiation: mozilla::Result<unsigned char, JS::Error&>::isErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinVariant const*, JS::Error&>::isErr() const |
336 | | |
337 | | /** Get the success value from this Result, which must be a success result. */ |
338 | 6.54M | V unwrap() const { |
339 | 6.54M | MOZ_ASSERT(isOk()); |
340 | 6.54M | return mImpl.unwrap(); |
341 | 6.54M | } Unexecuted instantiation: mozilla::Result<unsigned int, nsresult>::unwrap() const mozilla::Result<nsTString<char> const, nsresult>::unwrap() const Line | Count | Source | 338 | 48 | V unwrap() const { | 339 | 48 | MOZ_ASSERT(isOk()); | 340 | 48 | return mImpl.unwrap(); | 341 | 48 | } |
mozilla::Result<mozilla::PrefValueKind, nsresult>::unwrap() const Line | Count | Source | 338 | 4.18k | V unwrap() const { | 339 | 4.18k | MOZ_ASSERT(isOk()); | 340 | 4.18k | return mImpl.unwrap(); | 341 | 4.18k | } |
mozilla::Result<Pref*, nsresult>::unwrap() const Line | Count | Source | 338 | 3 | V unwrap() const { | 339 | 3 | MOZ_ASSERT(isOk()); | 340 | 3 | return mImpl.unwrap(); | 341 | 3 | } |
Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsIInputStream>, nsresult>::unwrap() const Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsIRequest>, nsresult>::unwrap() const mozilla::Result<nsTString<char>, nsresult>::unwrap() const Line | Count | Source | 338 | 5 | V unwrap() const { | 339 | 5 | MOZ_ASSERT(isOk()); | 340 | 5 | return mImpl.unwrap(); | 341 | 5 | } |
mozilla::Result<nsCOMPtr<nsIFile>, nsresult>::unwrap() const Line | Count | Source | 338 | 9 | V unwrap() const { | 339 | 9 | MOZ_ASSERT(isOk()); | 340 | 9 | return mImpl.unwrap(); | 341 | 9 | } |
Unexecuted instantiation: mozilla::Result<mozilla::URLPreloader::CacheKey, nsresult>::unwrap() const mozilla::Result<mozilla::FileLocation, nsresult>::unwrap() const Line | Count | Source | 338 | 24 | V unwrap() const { | 339 | 24 | MOZ_ASSERT(isOk()); | 340 | 24 | return mImpl.unwrap(); | 341 | 24 | } |
Unexecuted instantiation: mozilla::Result<nsIStyleSheetLinkingElement::Update, nsresult>::unwrap() const Unexecuted instantiation: mozilla::Result<nsCSSValueSharedList*, mozilla::layers::BogusAnimation>::unwrap() const Unexecuted instantiation: mozilla::Result<nsIFrame*, nsresult>::unwrap() const Unexecuted instantiation: mozilla::Result<mozilla::dom::MediaRecorder::Session::RunningState, nsresult>::unwrap() const Unexecuted instantiation: mozilla::Result<bool, nsresult>::unwrap() const Unexecuted instantiation: mozilla::Result<unsigned char, nsresult>::unwrap() const Unexecuted instantiation: mozilla::Result<unsigned short, nsresult>::unwrap() const Unexecuted instantiation: mozilla::Result<unsigned long, nsresult>::unwrap() const Unexecuted instantiation: mozilla::Result<short, nsresult>::unwrap() const Unexecuted instantiation: mozilla::Result<int, nsresult>::unwrap() const Unexecuted instantiation: mozilla::Result<long, nsresult>::unwrap() const Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsITimer>, nsresult>::unwrap() const Unexecuted instantiation: mozilla::Result<nsTString<char16_t>, nsresult>::unwrap() const Unexecuted instantiation: mozilla::Result<RefPtr<mozilla::dom::Promise>, nsresult>::unwrap() const Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsIZipReaderCache>, nsresult>::unwrap() const mozilla::Result<js::NativeObject*, JS::OOM&>::unwrap() const Line | Count | Source | 338 | 3.28M | V unwrap() const { | 339 | 3.28M | MOZ_ASSERT(isOk()); | 340 | 3.28M | return mImpl.unwrap(); | 341 | 3.28M | } |
mozilla::Result<js::jit::MBasicBlock*, js::jit::AbortReason>::unwrap() const Line | Count | Source | 338 | 70 | V unwrap() const { | 339 | 70 | MOZ_ASSERT(isOk()); | 340 | 70 | return mImpl.unwrap(); | 341 | 70 | } |
Unexecuted instantiation: mozilla::Result<js::jit::MInstruction*, js::jit::AbortReason>::unwrap() const mozilla::Result<js::jit::IonBuilder::InliningStatus, js::jit::AbortReason>::unwrap() const Line | Count | Source | 338 | 84 | V unwrap() const { | 339 | 84 | MOZ_ASSERT(isOk()); | 340 | 84 | return mImpl.unwrap(); | 341 | 84 | } |
Unexecuted instantiation: mozilla::Result<bool, js::jit::AbortReason>::unwrap() const mozilla::Result<js::jit::MCall*, js::jit::AbortReason>::unwrap() const Line | Count | Source | 338 | 70 | V unwrap() const { | 339 | 70 | MOZ_ASSERT(isOk()); | 340 | 70 | return mImpl.unwrap(); | 341 | 70 | } |
Unexecuted instantiation: mozilla::Result<js::jit::MDefinition*, js::jit::AbortReason>::unwrap() const mozilla::Result<js::jit::BarrierKind, js::jit::AbortReason>::unwrap() const Line | Count | Source | 338 | 14 | V unwrap() const { | 339 | 14 | MOZ_ASSERT(isOk()); | 340 | 14 | return mImpl.unwrap(); | 341 | 14 | } |
mozilla::Result<JSFunction*, JS::OOM&>::unwrap() const Line | Count | Source | 338 | 3.25M | V unwrap() const { | 339 | 3.25M | MOZ_ASSERT(isOk()); | 340 | 3.25M | return mImpl.unwrap(); | 341 | 3.25M | } |
Unexecuted instantiation: mozilla::Result<js::TypedObject*, JS::OOM&>::unwrap() const Unexecuted instantiation: mozilla::Result<js::ProxyObject*, JS::OOM&>::unwrap() const mozilla::Result<js::UnboxedObject*, JS::OOM&>::unwrap() const Line | Count | Source | 338 | 2 | V unwrap() const { | 339 | 2 | MOZ_ASSERT(isOk()); | 340 | 2 | return mImpl.unwrap(); | 341 | 2 | } |
Unexecuted instantiation: mozilla::Result<js::frontend::ParseNode*, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<mozilla::Ok, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<js::frontend::LexicalScopeNode*, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<js::frontend::ListNode*, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<js::frontend::CaseClause*, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<bool, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<JSAtom*, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::AssertedDeclaredKind, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<unsigned int, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::BinaryOperator, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::CompoundAssignmentOperator, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<js::frontend::FunctionBox*, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::VariableDeclarationKind, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<double, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::UnaryOperator, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::UpdateOperator, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<js::frontend::BinVariant, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::AssertedDeclaredKind, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::BinaryOperator, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::CompoundAssignmentOperator, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::VariableDeclarationKind, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::UnaryOperator, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::UpdateOperator, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<js::frontend::BinKind const*, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<unsigned char, JS::Error&>::unwrap() const Unexecuted instantiation: mozilla::Result<js::frontend::BinVariant const*, JS::Error&>::unwrap() const |
342 | | |
343 | | /** |
344 | | * Get the success value from this Result, which must be a success result. |
345 | | * If it is an error result, then return the aValue. |
346 | | */ |
347 | 3.18M | V unwrapOr(V aValue) const { |
348 | 3.18M | return isOk() ? mImpl.unwrap() : aValue; |
349 | 3.18M | } mozilla::Result<unsigned int, nsresult>::unwrapOr(unsigned int) const Line | Count | Source | 347 | 3.18M | V unwrapOr(V aValue) const { | 348 | 3.18M | return isOk() ? mImpl.unwrap() : aValue; | 349 | 3.18M | } |
Unexecuted instantiation: mozilla::Result<bool, nsresult>::unwrapOr(bool) const Unexecuted instantiation: mozilla::Result<unsigned char, nsresult>::unwrapOr(unsigned char) const Unexecuted instantiation: mozilla::Result<unsigned short, nsresult>::unwrapOr(unsigned short) const Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsITimer>, nsresult>::unwrapOr(nsCOMPtr<nsITimer>) const |
350 | | |
351 | | /** Get the error value from this Result, which must be an error result. */ |
352 | 9 | E unwrapErr() const { |
353 | 9 | MOZ_ASSERT(isErr()); |
354 | 9 | return mImpl.unwrapErr(); |
355 | 9 | } Unexecuted instantiation: mozilla::Result<unsigned int, nsresult>::unwrapErr() const Unexecuted instantiation: mozilla::Result<nsTString<char> const, nsresult>::unwrapErr() const mozilla::Result<mozilla::Ok, nsresult>::unwrapErr() const Line | Count | Source | 352 | 6 | E unwrapErr() const { | 353 | 6 | MOZ_ASSERT(isErr()); | 354 | 6 | return mImpl.unwrapErr(); | 355 | 6 | } |
Unexecuted instantiation: mozilla::Result<mozilla::PrefValueKind, nsresult>::unwrapErr() const Unexecuted instantiation: mozilla::Result<mozilla::Ok, char const*>::unwrapErr() const Unexecuted instantiation: mozilla::Result<Pref*, nsresult>::unwrapErr() const Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsIInputStream>, nsresult>::unwrapErr() const Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsIRequest>, nsresult>::unwrapErr() const Unexecuted instantiation: mozilla::Result<nsTString<char>, nsresult>::unwrapErr() const mozilla::Result<nsCOMPtr<nsIFile>, nsresult>::unwrapErr() const Line | Count | Source | 352 | 3 | E unwrapErr() const { | 353 | 3 | MOZ_ASSERT(isErr()); | 354 | 3 | return mImpl.unwrapErr(); | 355 | 3 | } |
Unexecuted instantiation: mozilla::Result<mozilla::URLPreloader::CacheKey, nsresult>::unwrapErr() const Unexecuted instantiation: mozilla::Result<mozilla::FileLocation, nsresult>::unwrapErr() const Unexecuted instantiation: mozilla::Result<mozilla::Ok, mozilla::layers::BogusAnimation>::unwrapErr() const Unexecuted instantiation: mozilla::Result<nsIFrame*, nsresult>::unwrapErr() const Unexecuted instantiation: mozilla::Result<nsIStyleSheetLinkingElement::Update, nsresult>::unwrapErr() const Unexecuted instantiation: mozilla::Result<unsigned char, nsresult>::unwrapErr() const Unexecuted instantiation: mozilla::Result<unsigned short, nsresult>::unwrapErr() const Unexecuted instantiation: mozilla::Result<unsigned long, nsresult>::unwrapErr() const Unexecuted instantiation: mozilla::Result<short, nsresult>::unwrapErr() const Unexecuted instantiation: mozilla::Result<int, nsresult>::unwrapErr() const Unexecuted instantiation: mozilla::Result<long, nsresult>::unwrapErr() const Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsITimer>, nsresult>::unwrapErr() const Unexecuted instantiation: mozilla::Result<nsTString<char16_t>, nsresult>::unwrapErr() const Unexecuted instantiation: mozilla::Result<RefPtr<mozilla::dom::Promise>, nsresult>::unwrapErr() const Unexecuted instantiation: mozilla::Result<bool, nsresult>::unwrapErr() const Unexecuted instantiation: mozilla::Result<nsCOMPtr<nsIZipReaderCache>, nsresult>::unwrapErr() const Unexecuted instantiation: mozilla::Result<mozilla::Ok, js::jit::AbortReason>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::jit::MBasicBlock*, js::jit::AbortReason>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::jit::MInstruction*, js::jit::AbortReason>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::jit::IonBuilder::InliningStatus, js::jit::AbortReason>::unwrapErr() const Unexecuted instantiation: mozilla::Result<bool, js::jit::AbortReason>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::jit::MCall*, js::jit::AbortReason>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::jit::MDefinition*, js::jit::AbortReason>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::jit::BarrierKind, js::jit::AbortReason>::unwrapErr() const Unexecuted instantiation: mozilla::Result<mozilla::Ok, JS::TranscodeResult>::unwrapErr() const Unexecuted instantiation: mozilla::Result<mozilla::Ok, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::frontend::ParseNode*, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::frontend::LexicalScopeNode*, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::frontend::ListNode*, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::frontend::CaseClause*, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<bool, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<JSAtom*, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::AssertedDeclaredKind, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<unsigned int, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::BinaryOperator, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<mozilla::Ok, js::frontend::ParseContext::BreakStatementError>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::CompoundAssignmentOperator, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<mozilla::Ok, js::frontend::ParseContext::ContinueStatementError>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::frontend::FunctionBox*, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::VariableDeclarationKind, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<double, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::UnaryOperator, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderMultipart>::UpdateOperator, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinVariant, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::AssertedDeclaredKind, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::BinaryOperator, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::CompoundAssignmentOperator, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::VariableDeclarationKind, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::UnaryOperator, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinASTParser<js::frontend::BinTokenReaderTester>::UpdateOperator, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinKind const*, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<unsigned char, JS::Error&>::unwrapErr() const Unexecuted instantiation: mozilla::Result<js::frontend::BinVariant const*, JS::Error&>::unwrapErr() const |
356 | | |
357 | | /** |
358 | | * Map a function V -> W over this result's success variant. If this result is |
359 | | * an error, do not invoke the function and return a copy of the error. |
360 | | * |
361 | | * Mapping over success values invokes the function to produce a new success |
362 | | * value: |
363 | | * |
364 | | * // Map Result<int, E> to another Result<int, E> |
365 | | * Result<int, E> res(5); |
366 | | * Result<int, E> res2 = res.map([](int x) { return x * x; }); |
367 | | * MOZ_ASSERT(res2.unwrap() == 25); |
368 | | * |
369 | | * // Map Result<const char*, E> to Result<size_t, E> |
370 | | * Result<const char*, E> res("hello, map!"); |
371 | | * Result<size_t, E> res2 = res.map(strlen); |
372 | | * MOZ_ASSERT(res2.unwrap() == 11); |
373 | | * |
374 | | * Mapping over an error does not invoke the function and copies the error: |
375 | | * |
376 | | * Result<V, int> res(5); |
377 | | * MOZ_ASSERT(res.isErr()); |
378 | | * Result<W, int> res2 = res.map([](V v) { ... }); |
379 | | * MOZ_ASSERT(res2.isErr()); |
380 | | * MOZ_ASSERT(res2.unwrapErr() == 5); |
381 | | */ |
382 | | template<typename F> |
383 | 0 | auto map(F f) const -> Result<decltype(f(*((V*) nullptr))), E> { |
384 | 0 | using RetResult = Result<decltype(f(*((V*) nullptr))), E>; |
385 | 0 | return isOk() ? RetResult(f(unwrap())) : RetResult(unwrapErr()); |
386 | 0 | } Unexecuted instantiation: _ZNK7mozilla6ResultIj8nsresultE3mapIZNS_12BufferReader6Read24EvEUljE_EENS0_IDTclfp_decvPjLDnEEES1_EET_ Unexecuted instantiation: _ZNK7mozilla6ResultIj8nsresultE3mapIZNKS_12BufferReader6Peek24EvEUljE_EENS0_IDTclfp_decvPjLDnEEES1_EET_ Unexecuted instantiation: Unified_cpp_bytestreams0.cpp:_ZNK7mozilla6ResultIh8nsresultE3mapIZNS_6AnnexB24ConvertExtraDataToAnnexBEPKNS_15MediaByteBufferEE3$_0EENS0_IDTclfp_decvPhLDnEEES1_EET_ Unexecuted instantiation: Unified_cpp_bytestreams0.cpp:_ZNK7mozilla6ResultIh8nsresultE3mapIZNS_6AnnexB24ConvertExtraDataToAnnexBEPKNS_15MediaByteBufferEE3$_1EENS0_IDTclfp_decvPhLDnEEES1_EET_ Unexecuted instantiation: Unified_cpp_bytestreams0.cpp:_ZNK7mozilla6ResultIh8nsresultE3mapIZNS_4H26416ExtractExtraDataEPKNS_12MediaRawDataEE3$_2EENS0_IDTclfp_decvPhLDnEEES1_EET_ Unexecuted instantiation: Unified_cpp_bytestreams0.cpp:_ZNK7mozilla6ResultIt8nsresultE3mapIZNS_4H26416ExtractExtraDataEPKNS_12MediaRawDataEE3$_3EENS0_IDTclfp_decvPtLDnEEES1_EET_ Unexecuted instantiation: Unified_cpp_bytestreams0.cpp:_ZNK7mozilla6ResultIj8nsresultE3mapIZNS_4H26416ExtractExtraDataEPKNS_12MediaRawDataEE3$_4EENS0_IDTclfp_decvPjLDnEEES1_EET_ Unexecuted instantiation: Unified_cpp_bytestreams0.cpp:_ZNK7mozilla6ResultIj8nsresultE3mapIZNS_4H26416ExtractExtraDataEPKNS_12MediaRawDataEE3$_5EENS0_IDTclfp_decvPjLDnEEES1_EET_ |
387 | | |
388 | | /** |
389 | | * Given a function V -> Result<W, E>, apply it to this result's success value |
390 | | * and return its result. If this result is an error value, then return a |
391 | | * copy. |
392 | | * |
393 | | * This is sometimes called "flatMap" or ">>=" in other contexts. |
394 | | * |
395 | | * `andThen`ing over success values invokes the function to produce a new |
396 | | * result: |
397 | | * |
398 | | * Result<const char*, Error> res("hello, andThen!"); |
399 | | * Result<HtmlFreeString, Error> res2 = res.andThen([](const char* s) { |
400 | | * return containsHtmlTag(s) |
401 | | * ? Result<HtmlFreeString, Error>(Error("Invalid: contains HTML")) |
402 | | * : Result<HtmlFreeString, Error>(HtmlFreeString(s)); |
403 | | * } |
404 | | * }); |
405 | | * MOZ_ASSERT(res2.isOk()); |
406 | | * MOZ_ASSERT(res2.unwrap() == HtmlFreeString("hello, andThen!"); |
407 | | * |
408 | | * `andThen`ing over error results does not invoke the function, and just |
409 | | * produces a new copy of the error result: |
410 | | * |
411 | | * Result<int, const char*> res("some error"); |
412 | | * auto res2 = res.andThen([](int x) { ... }); |
413 | | * MOZ_ASSERT(res2.isErr()); |
414 | | * MOZ_ASSERT(res.unwrapErr() == res2.unwrapErr()); |
415 | | */ |
416 | | template< |
417 | | typename F, |
418 | | typename = typename EnableIf< |
419 | | detail::IsResult<decltype((*((F*) nullptr))(*((V*) nullptr)))>::value |
420 | | >::Type |
421 | | > |
422 | 0 | auto andThen(F f) const -> decltype(f(*((V*) nullptr))) { |
423 | 0 | return isOk() ? f(unwrap()) : GenericErrorResult<E>(unwrapErr()); |
424 | 0 | } |
425 | | }; |
426 | | |
427 | | /** |
428 | | * A type that auto-converts to an error Result. This is like a Result without |
429 | | * a success type. It's the best return type for functions that always return |
430 | | * an error--functions designed to build and populate error objects. It's also |
431 | | * useful in error-handling macros; see MOZ_TRY for an example. |
432 | | */ |
433 | | template <typename E> |
434 | | class MOZ_MUST_USE_TYPE GenericErrorResult |
435 | | { |
436 | | E mErrorValue; |
437 | | |
438 | | template<typename V, typename E2> friend class Result; |
439 | | |
440 | | public: |
441 | 9 | explicit GenericErrorResult(E aErrorValue) : mErrorValue(aErrorValue) {} mozilla::GenericErrorResult<nsresult const&>::GenericErrorResult(nsresult const&) Line | Count | Source | 441 | 9 | explicit GenericErrorResult(E aErrorValue) : mErrorValue(aErrorValue) {} |
Unexecuted instantiation: mozilla::GenericErrorResult<nsresult&>::GenericErrorResult(nsresult&) Unexecuted instantiation: mozilla::GenericErrorResult<char const (&) [30]>::GenericErrorResult(char const (&) [30]) Unexecuted instantiation: mozilla::GenericErrorResult<char const (&) [29]>::GenericErrorResult(char const (&) [29]) Unexecuted instantiation: mozilla::GenericErrorResult<char const (&) [42]>::GenericErrorResult(char const (&) [42]) Unexecuted instantiation: mozilla::GenericErrorResult<char const (&) [36]>::GenericErrorResult(char const (&) [36]) Unexecuted instantiation: mozilla::GenericErrorResult<char const (&) [59]>::GenericErrorResult(char const (&) [59]) Unexecuted instantiation: mozilla::GenericErrorResult<char const (&) [32]>::GenericErrorResult(char const (&) [32]) Unexecuted instantiation: mozilla::GenericErrorResult<char const (&) [54]>::GenericErrorResult(char const (&) [54]) Unexecuted instantiation: mozilla::GenericErrorResult<mozilla::layers::BogusAnimation>::GenericErrorResult(mozilla::layers::BogusAnimation) Unexecuted instantiation: mozilla::GenericErrorResult<js::jit::AbortReason>::GenericErrorResult(js::jit::AbortReason) Unexecuted instantiation: mozilla::GenericErrorResult<JS::TranscodeResult&>::GenericErrorResult(JS::TranscodeResult&) Unexecuted instantiation: mozilla::GenericErrorResult<JS::TranscodeResult>::GenericErrorResult(JS::TranscodeResult) Unexecuted instantiation: mozilla::GenericErrorResult<JS::OOM&>::GenericErrorResult(JS::OOM&) Unexecuted instantiation: mozilla::GenericErrorResult<JS::Error&>::GenericErrorResult(JS::Error&) Unexecuted instantiation: mozilla::GenericErrorResult<js::frontend::ParseContext::BreakStatementError>::GenericErrorResult(js::frontend::ParseContext::BreakStatementError) Unexecuted instantiation: mozilla::GenericErrorResult<js::frontend::ParseContext::ContinueStatementError>::GenericErrorResult(js::frontend::ParseContext::ContinueStatementError) |
442 | | }; |
443 | | |
444 | | template <typename E> |
445 | | inline GenericErrorResult<E> |
446 | | Err(E&& aErrorValue) |
447 | 18 | { |
448 | 18 | return GenericErrorResult<E>(aErrorValue); |
449 | 18 | } mozilla::GenericErrorResult<nsresult const&> mozilla::Err<nsresult const&>(nsresult const&) Line | Count | Source | 447 | 9 | { | 448 | 9 | return GenericErrorResult<E>(aErrorValue); | 449 | 9 | } |
Unexecuted instantiation: mozilla::GenericErrorResult<nsresult&> mozilla::Err<nsresult&>(nsresult&) mozilla::GenericErrorResult<nsresult> mozilla::Err<nsresult>(nsresult&&) Line | Count | Source | 447 | 9 | { | 448 | 9 | return GenericErrorResult<E>(aErrorValue); | 449 | 9 | } |
Unexecuted instantiation: mozilla::GenericErrorResult<char const (&) [30]> mozilla::Err<char const (&) [30]>(char const (&) [30]) Unexecuted instantiation: mozilla::GenericErrorResult<char const (&) [29]> mozilla::Err<char const (&) [29]>(char const (&) [29]) Unexecuted instantiation: mozilla::GenericErrorResult<char const (&) [42]> mozilla::Err<char const (&) [42]>(char const (&) [42]) Unexecuted instantiation: mozilla::GenericErrorResult<char const (&) [36]> mozilla::Err<char const (&) [36]>(char const (&) [36]) Unexecuted instantiation: mozilla::GenericErrorResult<char const (&) [59]> mozilla::Err<char const (&) [59]>(char const (&) [59]) Unexecuted instantiation: mozilla::GenericErrorResult<char const (&) [32]> mozilla::Err<char const (&) [32]>(char const (&) [32]) Unexecuted instantiation: mozilla::GenericErrorResult<char const (&) [54]> mozilla::Err<char const (&) [54]>(char const (&) [54]) Unexecuted instantiation: mozilla::GenericErrorResult<mozilla::layers::BogusAnimation> mozilla::Err<mozilla::layers::BogusAnimation>(mozilla::layers::BogusAnimation&&) Unexecuted instantiation: mozilla::GenericErrorResult<js::jit::AbortReason> mozilla::Err<js::jit::AbortReason>(js::jit::AbortReason&&) Unexecuted instantiation: mozilla::GenericErrorResult<JS::TranscodeResult&> mozilla::Err<JS::TranscodeResult&>(JS::TranscodeResult&) Unexecuted instantiation: mozilla::GenericErrorResult<JS::TranscodeResult> mozilla::Err<JS::TranscodeResult>(JS::TranscodeResult&&) Unexecuted instantiation: mozilla::GenericErrorResult<JS::OOM&> mozilla::Err<JS::OOM&>(JS::OOM&) Unexecuted instantiation: mozilla::GenericErrorResult<JS::Error&> mozilla::Err<JS::Error&>(JS::Error&) Unexecuted instantiation: mozilla::GenericErrorResult<js::frontend::ParseContext::BreakStatementError> mozilla::Err<js::frontend::ParseContext::BreakStatementError>(js::frontend::ParseContext::BreakStatementError&&) Unexecuted instantiation: mozilla::GenericErrorResult<js::frontend::ParseContext::ContinueStatementError> mozilla::Err<js::frontend::ParseContext::ContinueStatementError>(js::frontend::ParseContext::ContinueStatementError&&) |
450 | | |
451 | | } // namespace mozilla |
452 | | |
453 | | /** |
454 | | * MOZ_TRY(expr) is the C++ equivalent of Rust's `try!(expr);`. First, it |
455 | | * evaluates expr, which must produce a Result value. On success, it |
456 | | * discards the result altogether. On error, it immediately returns an error |
457 | | * Result from the enclosing function. |
458 | | */ |
459 | | #define MOZ_TRY(expr) \ |
460 | 10.6k | do { \ |
461 | 10.6k | auto mozTryTempResult_ = ::mozilla::ToResult(expr); \ Unexecuted instantiation: Unified_cpp_extensions0.cpp:mozilla::ExtensionPolicyService::InjectContentScripts(mozilla::extensions::WebExtensionPolicy*)::$_0::operator()(nsIDocShell*) const::{lambda(JSContext*, JS::Handle<JS::Value>, mozilla::ExtensionPolicyService*, nsPIDOMWindowInner*, AutoTArray<RefPtr<mozilla::extensions::WebExtensionContentScript>, 8ul>&&)#1}::operator()(JSContext*, JS::Handle<JS::Value>, mozilla::ExtensionPolicyService*, nsPIDOMWindowInner*, AutoTArray<RefPtr<mozilla::extensions::WebExtensionContentScript>, 8ul>&&) const Unexecuted instantiation: Unified_cpp_extensions0.cpp:_ZZZN7mozilla22ExtensionPolicyService20InjectContentScriptsEPNS_10extensions18WebExtensionPolicyEENK3$_0clEP11nsIDocShellENKUlT_E_clI6RefPtrINS_3dom7PromiseEEEEDaS7_ Unexecuted instantiation: Unified_cpp_extensions0.cpp:_ZZZZN7mozilla22ExtensionPolicyService20InjectContentScriptsEPNS_10extensions18WebExtensionPolicyEENK3$_0clEP11nsIDocShellENKUlT_E_clI6RefPtrINS_3dom7PromiseEEEEDaS7_ENKUlP9JSContextN2JS6HandleINSG_5ValueEEEPS0_P18nsPIDOMWindowInnerO10AutoTArrayISA_INS1_25WebExtensionContentScriptEELm8EEE_clESF_SJ_SK_SM_SR_ |
462 | 10.6k | if (mozTryTempResult_.isErr()) { \ |
463 | 6 | return ::mozilla::Err(mozTryTempResult_.unwrapErr()); \ |
464 | 6 | } \ |
465 | 10.6k | } while (0) |
466 | | |
467 | | /** |
468 | | * MOZ_TRY_VAR(target, expr) is the C++ equivalent of Rust's `target = try!(expr);`. |
469 | | * First, it evaluates expr, which must produce a Result value. |
470 | | * On success, the result's success value is assigned to target. |
471 | | * On error, immediately returns the error result. |
472 | | * |target| must evaluate to a reference without any side effects. |
473 | | */ |
474 | | #define MOZ_TRY_VAR(target, expr) \ |
475 | 4.50k | do { \ |
476 | 4.50k | auto mozTryVarTempResult_ = (expr); \ Unified_cpp_modules_libpref0.cpp:mozilla::Preferences::Lock(char const*)::$_1::operator()(PrefWrapper const&) const Line | Count | Source | 476 | 3 | auto mozTryVarTempResult_ = (expr); \ |
Unexecuted instantiation: Unified_cpp_modules_libpref0.cpp:mozilla::Preferences::Unlock(char const*)::$_2::operator()(PrefWrapper const&) const |
477 | 4.50k | if (mozTryVarTempResult_.isErr()) { \ |
478 | 3 | return ::mozilla::Err( \ |
479 | 3 | mozTryVarTempResult_.unwrapErr()); \ |
480 | 3 | } \ |
481 | 4.50k | (target) = mozTryVarTempResult_.unwrap(); \ |
482 | 4.50k | } while (0) |
483 | | |
484 | | #endif // mozilla_Result_h |