WTF: Update std::expected to match current proposal
authorjfbastien@apple.com <jfbastien@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Oct 2017 20:54:26 +0000 (20:54 +0000)
committerjfbastien@apple.com <jfbastien@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Oct 2017 20:54:26 +0000 (20:54 +0000)
commitaed3d9c161107ab790008ec3f5ed613bdeb05a9d
tree370faaa4c34dfcca038b620c2de19c33fbe6b9b9
parent43ec8b9dc8a06a92f2c8f52002d9f268441af939
WTF: Update std::expected to match current proposal
https://bugs.webkit.org/show_bug.cgi?id=177881

Reviewed by Mark Lam.

Source/JavaScriptCore:

Update API.

* wasm/WasmB3IRGenerator.cpp:
* wasm/WasmModule.cpp:
(JSC::Wasm::makeValidationResult):
* wasm/WasmParser.h:
* wasm/WasmValidate.cpp:
* wasm/generateWasmValidateInlinesHeader.py:
(loadMacro):
(storeMacro):

Source/WTF:

The proposal is likely to be in C++20 and I've been asked to help co-champion
it. I'm therefore updating our implementation to more closely match the current
proposal, and to make sure it'll work for us if standardized.

 - Rename UnexpectedType to Unexpected to match the proposal.
 - Remove relational operators, only equality / inequality remains.
 - Fix minor type signatures.
 - Add UnexpectedType typedef.
 - Uncomment rebind implementation.
 - Add in-place construction tag, as well as explicit error construction tag.
 - Add template unexpected constructor.
 - Note that make_unexpected isn't in the proposal anymore, but we keep it because we don't have C++17 deduction guides.
 - Remove hashing, which isn't in the proposal anymore.

* wtf/Expected.h:
(WTF::Unexpected::Unexpected):
(WTF::Unexpected::value const):
(WTF::operator==):
(WTF::operator!=):
(WTF::makeUnexpected):
(WTF::Expected::Expected):
(WTF::Expected::operator=):
(WTF::Expected::getUnexpected const):

Tools:

The proposal is likely to be in C++20 and I've been asked to help co-champion
it. I'm therefore updating our implementation to more closely match the current
proposal, and to make sure it'll work for us if standardized.

 - Rename UnexpectedType to Unexpected to match the proposal.
 - Remove relational operators, only equality / inequality remains.
 - Fix minor type signatures.
 - Add UnexpectedType typedef.
 - Uncomment rebind implementation.
 - Add in-place construction tag, as well as explicit error construction tag.
 - Add template unexpected constructor.
 - Note that make_unexpected isn't in the proposal anymore, but we keep it because we don't have C++17 deduction guides.
 - Remove hashing, which isn't in the proposal anymore.

* TestWebKitAPI/Tests/WTF/Expected.cpp:
(WTF::operator<<):
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222878 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp
Source/JavaScriptCore/wasm/WasmModule.cpp
Source/JavaScriptCore/wasm/WasmParser.h
Source/JavaScriptCore/wasm/WasmValidate.cpp
Source/JavaScriptCore/wasm/generateWasmValidateInlinesHeader.py
Source/WTF/ChangeLog
Source/WTF/wtf/Expected.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/Expected.cpp