Bug 1025184 - Make ConstTwoByteChars a Range. r=jandem

This commit is contained in:
Tooru Fujisawa 2015-02-10 12:52:18 +09:00
parent fb9a27f3f9
commit 6b7cecf106
3 changed files with 7 additions and 11 deletions

View File

@ -536,7 +536,7 @@ nsJSONListener::OnStopRequest(nsIRequest *aRequest, nsISupports *aContext,
JS::ConstTwoByteChars chars(reinterpret_cast<const char16_t*>(mBufferedChars.Elements()),
mBufferedChars.Length());
bool ok = JS_ParseJSONWithReviver(mCx, chars.get(),
bool ok = JS_ParseJSONWithReviver(mCx, chars.start().get(),
uint32_t(mBufferedChars.Length()),
reviver, &value);

View File

@ -151,17 +151,13 @@ typedef mozilla::RangedPtr<const char16_t> ConstCharPtr;
/*
* Like TwoByteChars, but the chars are const.
*/
class ConstTwoByteChars : public mozilla::RangedPtr<const char16_t>
class ConstTwoByteChars : public mozilla::Range<const char16_t>
{
public:
ConstTwoByteChars(const ConstTwoByteChars &s) : ConstCharPtr(s) {}
MOZ_IMPLICIT ConstTwoByteChars(const mozilla::RangedPtr<const char16_t> &s) : ConstCharPtr(s) {}
ConstTwoByteChars(const char16_t *s, size_t len) : ConstCharPtr(s, len) {}
ConstTwoByteChars(const char16_t *pos, const char16_t *start, size_t len)
: ConstCharPtr(pos, start, len)
{}
typedef mozilla::Range<const char16_t> Base;
using ConstCharPtr::operator=;
public:
ConstTwoByteChars() : Base() {}
ConstTwoByteChars(const char16_t *aChars, size_t aLength) : Base(aChars, aLength) {}
};
/*

View File

@ -1820,7 +1820,7 @@ FunctionConstructor(JSContext *cx, unsigned argc, Value *vp, GeneratorKind gener
* here (duplicate argument names, etc.) will be detected when we
* compile the function body.
*/
TokenStream ts(cx, options, collected_args.get(), args_length,
TokenStream ts(cx, options, collected_args.start().get(), args_length,
/* strictModeGetter = */ nullptr);
bool yieldIsValidName = ts.versionNumber() < JSVERSION_1_7 && !isStarGenerator;