#include minimization, MOZ_STACK_CLASS application, and other minor jsonparser.h cleanups. No bug, r=lumpy

--HG--
extra : rebase_source : cacc7a0bd2668f247c09bdb6c487755c9a008f90
This commit is contained in:
Jeff Walden 2013-05-24 13:55:26 -07:00
Родитель 0de2cfbca3
Коммит 7f1070c9de
1 изменённых файлов: 10 добавлений и 12 удалений

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

@ -9,15 +9,13 @@
#include "mozilla/Attributes.h"
#include "jscntxt.h"
#include "jsstr.h"
#include "jsapi.h"
#include "vm/String.h"
namespace js {
/*
* NB: This class must only be used on the stack.
*/
class JSONParser : private AutoGCRooter
class MOZ_STACK_CLASS JSONParser : private AutoGCRooter
{
public:
enum ErrorHandling { RaiseError, NoError };
@ -141,23 +139,23 @@ class JSONParser : private AutoGCRooter
* otherwise return true and set *vp to |undefined|. (JSON syntax can't
* represent |undefined|, so the JSON data couldn't have specified it.)
*/
bool parse(js::MutableHandleValue vp);
bool parse(MutableHandleValue vp);
private:
js::Value numberValue() const {
Value numberValue() const {
JS_ASSERT(lastToken == Number);
JS_ASSERT(v.isNumber());
return v;
}
js::Value stringValue() const {
Value stringValue() const {
JS_ASSERT(lastToken == String);
JS_ASSERT(v.isString());
return v;
}
JSAtom *atomValue() const {
js::Value strval = stringValue();
Value strval = stringValue();
return &strval.toString()->asAtom();
}
@ -171,7 +169,7 @@ class JSONParser : private AutoGCRooter
}
Token stringToken(JSString *str) {
this->v = js::StringValue(str);
this->v = StringValue(str);
#ifdef DEBUG
lastToken = String;
#endif
@ -179,7 +177,7 @@ class JSONParser : private AutoGCRooter
}
Token numberToken(double d) {
this->v = js::NumberValue(d);
this->v = NumberValue(d);
#ifdef DEBUG
lastToken = Number;
#endif