Merge JSScope into JSObject and JSScopeProperty (now js::Shape; bug 558451, r=jorendorff).

This commit is contained in:
Brendan Eich
2010-08-29 11:57:08 -07:00
parent d26f1348e2
commit dbf92fe204
52 changed files with 4407 additions and 4986 deletions

View File

@@ -256,12 +256,13 @@ EnumerateNativeProperties(JSContext *cx, JSObject *obj, JSObject *pobj, uintN fl
size_t initialLength = props.length();
/* Collect all unique properties from this object's scope. */
JSScope *scope = pobj->scope();
for (JSScopeProperty *sprop = scope->lastProperty(); sprop; sprop = sprop->parent) {
if (!JSID_IS_DEFAULT_XML_NAMESPACE(sprop->id) &&
!sprop->isAlias() &&
!Enumerate<EnumPolicy>(cx, obj, pobj, sprop->id, sprop->enumerable(), sprop->isSharedPermanent(),
flags, ht, props))
for (Shape::Range r = pobj->lastProperty()->all(); !r.empty(); r.popFront()) {
const Shape &shape = r.front();
if (!JSID_IS_DEFAULT_XML_NAMESPACE(shape.id) &&
!shape.isAlias() &&
!Enumerate<EnumPolicy>(cx, obj, pobj, shape.id, shape.enumerable(),
shape.isSharedPermanent(), flags, ht, props))
{
return false;
}
@@ -269,7 +270,7 @@ EnumerateNativeProperties(JSContext *cx, JSObject *obj, JSObject *pobj, uintN fl
Reverse(props.begin() + initialLength, props.end());
JS_UNLOCK_SCOPE(cx, scope);
JS_UNLOCK_OBJ(cx, pobj);
return true;
}
@@ -455,8 +456,8 @@ NewIteratorObject(JSContext *cx, uintN flags)
JSObject *obj = js_NewGCObject(cx);
if (!obj)
return false;
obj->map = cx->runtime->emptyEnumeratorScope->hold();
obj->init(&js_IteratorClass, NULL, NULL, NullValue());
obj->init(&js_IteratorClass, NULL, NULL, NullValue(), cx);
obj->setMap(cx->runtime->emptyEnumeratorShape);
return obj;
}
@@ -853,7 +854,7 @@ js_SuppressDeletedProperty(JSContext *cx, JSObject *obj, jsid id)
if (prop) {
uintN attrs;
if (obj2.object()->isNative()) {
attrs = ((JSScopeProperty *) prop)->attributes();
attrs = ((Shape *) prop)->attributes();
JS_UNLOCK_OBJ(cx, obj2.object());
} else if (!obj2.object()->getAttributes(cx, id, &attrs)) {
return false;