Bug 1606568 - Add JS::ConstLatin1Chars. r=jwalden

Useful for the public BigInt API which takes Range<const CharT>. Allows

JS::NumberToBigInt(JSContext*, JS::ConstLatin1Chars)

in order to match

JS::NumberToBigInt(JSContext*, JS::ConstTwoByteChars)

which already exists.

Differential Revision: https://phabricator.services.mozilla.com/D82797
This commit is contained in:
Philip Chimento 2020-07-20 23:58:27 +00:00
Родитель 1da86c00bd
Коммит 602751eaef
1 изменённых файлов: 14 добавлений и 0 удалений

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

@ -40,6 +40,20 @@ class Latin1Chars : public mozilla::Range<Latin1Char> {
aLength) {}
};
/*
* Like Latin1Chars, but the chars are const.
*/
class ConstLatin1Chars : public mozilla::Range<const Latin1Char> {
typedef mozilla::Range<const Latin1Char> Base;
public:
using CharT = Latin1Char;
ConstLatin1Chars() = default;
ConstLatin1Chars(const Latin1Char* aChars, size_t aLength)
: Base(aChars, aLength) {}
};
/*
* A Latin1Chars, but with \0 termination for C compatibility.
*/