Bug 891215 (part 4) - Slim down ParseNode-inl.h. r=terrence.

--HG--
extra : rebase_source : 282aa80825d69f2faf012d920ac0cf916dda6b93
This commit is contained in:
Nicholas Nethercote 2013-07-08 20:20:00 -07:00
Родитель 406499c9fe
Коммит c842453d5a
2 изменённых файлов: 13 добавлений и 17 удалений

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

@ -13,22 +13,6 @@
namespace js {
namespace frontend {
inline bool
UpvarCookie::set(JSContext *cx, unsigned newLevel, uint16_t newSlot)
{
// This is an unsigned-to-uint16_t conversion, test for too-high values.
// In practice, recursion in Parser and/or BytecodeEmitter will blow the
// stack if we nest functions more than a few hundred deep, so this will
// never trigger. Oh well.
if (newLevel >= FREE_LEVEL) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_TOO_DEEP, js_function_str);
return false;
}
level_ = newLevel;
slot_ = newSlot;
return true;
}
inline PropertyName *
ParseNode::name() const
{

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

@ -51,7 +51,19 @@ class UpvarCookie
uint16_t slot() const { JS_ASSERT(!isFree()); return slot_; }
// This fails and issues an error message if newLevel is too large.
bool set(JSContext *cx, unsigned newLevel, uint16_t newSlot);
bool set(JSContext *cx, unsigned newLevel, uint16_t newSlot) {
// This is an unsigned-to-uint16_t conversion, test for too-high
// values. In practice, recursion in Parser and/or BytecodeEmitter
// will blow the stack if we nest functions more than a few hundred
// deep, so this will never trigger. Oh well.
if (newLevel >= FREE_LEVEL) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_TOO_DEEP, js_function_str);
return false;
}
level_ = newLevel;
slot_ = newSlot;
return true;
}
void makeFree() {
level_ = FREE_LEVEL;