Bug 1025184 - Make ConstTwoByteChars a Range. r=jandem

This commit is contained in:
Tooru Fujisawa
2015-02-10 12:52:18 +09:00
parent da1eb2b040
commit cae531825b
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()), JS::ConstTwoByteChars chars(reinterpret_cast<const char16_t*>(mBufferedChars.Elements()),
mBufferedChars.Length()); mBufferedChars.Length());
bool ok = JS_ParseJSONWithReviver(mCx, chars.get(), bool ok = JS_ParseJSONWithReviver(mCx, chars.start().get(),
uint32_t(mBufferedChars.Length()), uint32_t(mBufferedChars.Length()),
reviver, &value); reviver, &value);

View File

@@ -151,17 +151,13 @@ typedef mozilla::RangedPtr<const char16_t> ConstCharPtr;
/* /*
* Like TwoByteChars, but the chars are const. * Like TwoByteChars, but the chars are const.
*/ */
class ConstTwoByteChars : public mozilla::RangedPtr<const char16_t> class ConstTwoByteChars : public mozilla::Range<const char16_t>
{ {
public: typedef mozilla::Range<const char16_t> Base;
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)
{}
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 * here (duplicate argument names, etc.) will be detected when we
* compile the function body. * 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); /* strictModeGetter = */ nullptr);
bool yieldIsValidName = ts.versionNumber() < JSVERSION_1_7 && !isStarGenerator; bool yieldIsValidName = ts.versionNumber() < JSVERSION_1_7 && !isStarGenerator;