Bug 1579862 - Making single-arg constructors explicit;r=arai

Differential Revision: https://phabricator.services.mozilla.com/D45813

--HG--
extra : moz-landing-system : lando
This commit is contained in:
David Teller 2019-09-13 08:49:02 +00:00
Родитель 37fa21b5a0
Коммит 85b6f0a442
2 изменённых файлов: 14 добавлений и 11 удалений

Просмотреть файл

@ -1734,11 +1734,11 @@ HuffmanTableImplementationGeneric<T>::begin() const {
return this->implementation.match(
[](const HuffmanTableImplementationSaturated<T>& implementation)
-> HuffmanTableImplementationGeneric<T>::Iterator {
return implementation.begin();
return Iterator(implementation.begin());
},
[](const HuffmanTableImplementationMap<T>& implementation)
-> HuffmanTableImplementationGeneric<T>::Iterator {
return implementation.begin();
return Iterator(implementation.begin());
},
[](const HuffmanTableUnreachable&)
-> HuffmanTableImplementationGeneric<T>::Iterator {
@ -1752,11 +1752,11 @@ HuffmanTableImplementationGeneric<T>::end() const {
return this->implementation.match(
[](const HuffmanTableImplementationSaturated<T>& implementation)
-> HuffmanTableImplementationGeneric<T>::Iterator {
return implementation.end();
return Iterator(implementation.end());
},
[](const HuffmanTableImplementationMap<T>& implementation)
-> HuffmanTableImplementationGeneric<T>::Iterator {
return implementation.end();
return Iterator(implementation.end());
},
[](const HuffmanTableUnreachable&)
-> HuffmanTableImplementationGeneric<T>::Iterator {
@ -1964,7 +1964,7 @@ HuffmanEntry<const T*> HuffmanTableImplementationMap<T>::lookup(
const uint32_t bits = lookup.leadingBits(bitLength);
const HuffmanKey key(bits, bitLength);
const FlatHuffmanKey flat(key);
if (auto ptr = values.lookup(key)) {
if (auto ptr = values.lookup(flat)) {
// Entry found.
return HuffmanEntry<const T*>(bits, bitLength, &ptr->value());
}

Просмотреть файл

@ -130,8 +130,8 @@ struct HuffmanKey {
// A Huffman key represented as a single `uint32_t`.
struct FlatHuffmanKey {
FlatHuffmanKey(HuffmanKey key);
FlatHuffmanKey(const HuffmanKey* key);
explicit FlatHuffmanKey(HuffmanKey key);
explicit FlatHuffmanKey(const HuffmanKey* key);
// 0b0000000L_LLLLCCCC_CCCCCCCC_CCCCCCCC
// Where:
@ -489,8 +489,8 @@ struct HuffmanTableUnreachable {};
//
template <typename T>
struct HuffmanTableImplementationGeneric {
HuffmanTableImplementationGeneric(JSContext* cx);
HuffmanTableImplementationGeneric() = delete;
explicit HuffmanTableImplementationGeneric(JSContext* cx);
explicit HuffmanTableImplementationGeneric() = delete;
// Initialize a Huffman table containing a single value.
JS::Result<Ok> initWithSingleValue(JSContext* cx, T&& value);
@ -511,8 +511,11 @@ struct HuffmanTableImplementationGeneric {
size_t length() const;
struct Iterator {
Iterator(typename HuffmanTableImplementationSaturated<T>::Iterator&&);
Iterator(typename HuffmanTableImplementationMap<T>::Iterator&&);
explicit Iterator(
typename HuffmanTableImplementationSaturated<T>::Iterator&&);
explicit Iterator(typename HuffmanTableImplementationMap<T>::Iterator&&);
Iterator(Iterator&&) = default;
Iterator(const Iterator&) = default;
void operator++();
const T* operator*() const;
bool operator==(const Iterator& other) const;