Changeset 11836 in webkit for trunk/JavaScriptCore/kjs/object.cpp
- Timestamp:
- Dec 30, 2005, 1:44:50 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/object.cpp
r11774 r11836 219 219 } 220 220 221 // Check if there are any setters or getters in the prototype chain 221 222 JSObject *obj = this; 223 bool hasGettersOrSetters = false; 222 224 while (true) { 223 JSValue *gs; 224 int attributes; 225 if (obj->_prop.hasGetterSetterProperties() && (gs = obj->_prop.get(propertyName, attributes))) { 226 if (attributes & GetterSetter) { 227 JSObject *setterFunc = static_cast<GetterSetterImp *>(gs)->getSetter(); 228 229 if (!setterFunc) { 230 throwSetterError(exec); 231 return; 232 } 233 234 List args; 235 args.append(value); 236 237 setterFunc->call(exec, this, args); 238 return; 239 } else { 240 // If there's an existing property on the object or one of its 241 // prototype it should be replaced, so we just break here. 242 break; 243 } 244 } 245 225 if (obj->_prop.hasGetterSetterProperties()) { 226 hasGettersOrSetters = true; 227 break; 228 } 229 246 230 if (!obj->_proto->isObject()) 247 231 break; 232 233 obj = static_cast<JSObject *>(obj->_proto); 234 } 235 236 if (hasGettersOrSetters) { 237 obj = this; 238 while (true) { 239 int attributes; 240 if (JSValue *gs = obj->_prop.get(propertyName, attributes)) { 241 if (attributes & GetterSetter) { 242 JSObject *setterFunc = static_cast<GetterSetterImp *>(gs)->getSetter(); 248 243 249 obj = static_cast<JSObject *>(obj->_proto); 250 } 251 244 if (!setterFunc) { 245 throwSetterError(exec); 246 return; 247 } 248 249 List args; 250 args.append(value); 251 252 setterFunc->call(exec, this, args); 253 return; 254 } else { 255 // If there's an existing property on the object or one of its 256 // prototype it should be replaced, so we just break here. 257 break; 258 } 259 } 260 261 if (!obj->_proto->isObject()) 262 break; 263 264 obj = static_cast<JSObject *>(obj->_proto); 265 } 266 } 267 252 268 _prop.put(propertyName,value,attr); 253 269 }
Note:
See TracChangeset
for help on using the changeset viewer.