Changeset 36125 in webkit for trunk/JavaScriptCore/VM/JSPropertyNameIterator.h
- Timestamp:
- Sep 5, 2008, 9:59:53 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/VM/JSPropertyNameIterator.h
r35830 r36125 30 30 #define JSPropertyNameIterator_h 31 31 32 #include "JSCell.h" 32 #include "JSObject.h" 33 #include "JSString.h" 34 #include "PropertyNameArray.h" 33 35 34 36 namespace KJS { … … 64 66 }; 65 67 68 inline JSPropertyNameIterator::JSPropertyNameIterator(JSObject* object, Identifier* propertyNames, size_t numProperties) 69 : m_object(object) 70 , m_propertyNames(propertyNames) 71 , m_position(propertyNames) 72 , m_end(propertyNames + numProperties) 73 { 74 } 75 76 inline JSPropertyNameIterator* JSPropertyNameIterator::create(ExecState* exec, JSValue* v) 77 { 78 if (v->isUndefinedOrNull()) 79 return new (exec) JSPropertyNameIterator(0, 0, 0); 80 81 JSObject* o = v->toObject(exec); 82 PropertyNameArray propertyNames(exec); 83 o->getPropertyNames(exec, propertyNames); 84 size_t numProperties = propertyNames.size(); 85 return new (exec) JSPropertyNameIterator(o, propertyNames.releaseIdentifiers(), numProperties); 86 } 87 88 inline JSValue* JSPropertyNameIterator::next(ExecState* exec) 89 { 90 while (m_position != m_end) { 91 if (m_object->hasProperty(exec, *m_position)) 92 return jsOwnedString(exec, (*m_position++).ustring()); 93 m_position++; 94 } 95 invalidate(); 96 return 0; 97 } 98 66 99 } // namespace KJS 67 100
Note:
See TracChangeset
for help on using the changeset viewer.