Nit-picks, mainly localizing and initializing the oldAttrs var, on patchwork for bug 599009 (r=bz).

This commit is contained in:
Brendan Eich 2010-10-07 11:33:23 -07:00
Родитель c3c6f4378f
Коммит c4ead6da5c
2 изменённых файлов: 31 добавлений и 31 удалений

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

@ -5379,23 +5379,24 @@ BEGIN_CASE(JSOP_DEFFUN)
bool doSet = false;
if (prop) {
JS_ASSERT((attrs == JSPROP_ENUMERATE) == regs.fp->isEvalFrame());
uint32 old;
if (attrs == JSPROP_ENUMERATE ||
(parent == pobj &&
parent->isCall() &&
(old = ((Shape *) prop)->attributes(),
!(old & (JSPROP_GETTER|JSPROP_SETTER)) &&
(old & (JSPROP_ENUMERATE|JSPROP_PERMANENT)) == attrs))) {
/*
* js_CheckRedeclaration must reject attempts to add a getter or
* setter to an existing property without a getter or setter.
*/
JS_ASSERT(!(attrs & ~(JSPROP_ENUMERATE|JSPROP_PERMANENT)));
JS_ASSERT_IF(attrs != JSPROP_ENUMERATE, !(old & JSPROP_READONLY));
doSet = true;
if (attrs == JSPROP_ENUMERATE || (parent == pobj && parent->isCall())) {
JS_ASSERT(pobj->isNative());
uintN oldAttrs = ((Shape *) prop)->attributes();
if (!(oldAttrs & (JSPROP_GETTER|JSPROP_SETTER)) &&
(oldAttrs & (JSPROP_ENUMERATE|JSPROP_PERMANENT)) == attrs) {
/*
* js_CheckRedeclaration must reject attempts to add a getter or
* setter to an existing property without a getter or setter.
*/
JS_ASSERT(!(attrs & ~(JSPROP_ENUMERATE|JSPROP_PERMANENT)));
JS_ASSERT(!(oldAttrs & JSPROP_READONLY));
doSet = true;
}
}
pobj->dropProperty(cx, prop);
}
Value rval = ObjectValue(*obj);
ok = doSet
? parent->setProperty(cx, id, &rval, script->strictModeCode)

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

@ -914,9 +914,6 @@ stubs::DefFun(VMFrame &f, JSFunction *fun)
*/
JSObject *parent = &fp->varobj(cx);
uint32 old;
bool doSet;
/*
* Check for a const property of the same name -- or any kind of property
* if executing with the strict option. We check here at runtime as well
@ -940,25 +937,27 @@ stubs::DefFun(VMFrame &f, JSFunction *fun)
* setters that store the value of the property in the interpreter frame,
* see bug 467495.
*/
doSet = false;
bool doSet = false;
if (prop) {
JS_ASSERT((attrs == JSPROP_ENUMERATE) == fp->isEvalFrame());
if (attrs == JSPROP_ENUMERATE ||
(parent == pobj &&
parent->isCall() &&
(old = ((Shape *) prop)->attributes(),
!(old & (JSPROP_GETTER|JSPROP_SETTER)) &&
(old & (JSPROP_ENUMERATE|JSPROP_PERMANENT)) == attrs))) {
/*
* js_CheckRedeclaration must reject attempts to add a getter or
* setter to an existing property without a getter or setter.
*/
JS_ASSERT(!(attrs & ~(JSPROP_ENUMERATE|JSPROP_PERMANENT)));
JS_ASSERT_IF(attrs != JSPROP_ENUMERATE, !(old & JSPROP_READONLY));
doSet = true;
if (attrs == JSPROP_ENUMERATE || (parent == pobj && parent->isCall())) {
JS_ASSERT(pobj->isNative());
uintN oldAttrs = ((Shape *) prop)->attributes();
if (!(oldAttrs & (JSPROP_GETTER|JSPROP_SETTER)) &&
(oldAttrs & (JSPROP_ENUMERATE|JSPROP_PERMANENT)) == attrs) {
/*
* js_CheckRedeclaration must reject attempts to add a getter or
* setter to an existing property without a getter or setter.
*/
JS_ASSERT(!(attrs & ~(JSPROP_ENUMERATE|JSPROP_PERMANENT)));
JS_ASSERT(!(oldAttrs & JSPROP_READONLY));
doSet = true;
}
}
pobj->dropProperty(cx, prop);
}
Value rval = ObjectValue(*obj);
ok = doSet
? parent->setProperty(cx, id, &rval, strict)