Changeset 34372 in webkit for trunk/JavaScriptCore/VM/JSPropertyNameIterator.cpp
- Timestamp:
- Jun 4, 2008, 10:36:55 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/VM/JSPropertyNameIterator.cpp
r33979 r34372 34 34 #include "PropertyNameArray.h" 35 35 36 namespace KJS {36 namespace KJS { 37 37 38 38 COMPILE_ASSERT(sizeof(JSPropertyNameIterator) <= CellSize<sizeof(void*)>::m_value, JSPropertyNameIteratorSizeASSERT); 39 39 40 JSPropertyNameIterator* JSPropertyNameIterator::create(ExecState* exec, JSValue* v) 41 { 42 if (v->isUndefinedOrNull()) 43 return new JSPropertyNameIterator(0, 0, 0); 44 45 JSObject* o = v->toObject(exec); 46 PropertyNameArray propertyNames; 47 o->getPropertyNames(exec, propertyNames); 48 size_t numProperties = propertyNames.size(); 49 return new JSPropertyNameIterator(o, propertyNames.releaseIdentifiers(), numProperties); 50 } 51 40 52 JSPropertyNameIterator::JSPropertyNameIterator(JSObject* object, Identifier* propertyNames, size_t numProperties) 41 53 : m_object(object) … … 45 57 { 46 58 } 47 48 JSType JSPropertyNameIterator::type() const { 49 return UnspecifiedType; 59 60 JSPropertyNameIterator::~JSPropertyNameIterator() 61 { 62 delete m_propertyNames; 50 63 } 51 64 52 JSValue *JSPropertyNameIterator::toPrimitive(ExecState *, JSType) const 65 JSType JSPropertyNameIterator::type() const 66 { 67 return UnspecifiedType; 68 } 69 70 JSValue* JSPropertyNameIterator::toPrimitive(ExecState*, JSType) const 53 71 { 54 72 ASSERT_NOT_REACHED(); 55 return 0; 73 return 0; 56 74 } 57 75 58 bool JSPropertyNameIterator::getPrimitiveNumber(ExecState*, double&, JSValue*&) { 59 ASSERT_NOT_REACHED(); 76 bool JSPropertyNameIterator::getPrimitiveNumber(ExecState*, double&, JSValue*&) 77 { 78 ASSERT_NOT_REACHED(); 60 79 return false; 61 80 } 62 81 63 bool JSPropertyNameIterator::toBoolean(ExecState *) const { 64 ASSERT_NOT_REACHED(); 82 bool JSPropertyNameIterator::toBoolean(ExecState*) const 83 { 84 ASSERT_NOT_REACHED(); 65 85 return false; 66 86 } 67 87 68 double JSPropertyNameIterator::toNumber(ExecState *) const88 double JSPropertyNameIterator::toNumber(ExecState*) const 69 89 { 70 90 ASSERT_NOT_REACHED(); 71 return 0; 91 return 0; 72 92 } 73 93 74 UString JSPropertyNameIterator::toString(ExecState *) const94 UString JSPropertyNameIterator::toString(ExecState*) const 75 95 { 76 96 ASSERT_NOT_REACHED(); 77 return ""; 97 return ""; 78 98 } 79 99 80 JSObject *JSPropertyNameIterator::toObject(ExecState *) const100 JSObject* JSPropertyNameIterator::toObject(ExecState*) const 81 101 { 82 102 ASSERT_NOT_REACHED(); 83 return 0; 103 return 0; 84 104 } 85 105 86 void JSPropertyNameIterator::mark() { 106 void JSPropertyNameIterator::mark() 107 { 87 108 JSCell::mark(); 88 109 if (m_object && !m_object->marked()) … … 91 112 92 113 JSValue* JSPropertyNameIterator::next(ExecState* exec) 93 { 114 { 94 115 while (m_position != m_end) { 95 116 if (m_object->hasProperty(exec, *m_position)) … … 101 122 } 102 123 103 void JSPropertyNameIterator::invalidate() 104 { 105 delete m_propertyNames; 124 void JSPropertyNameIterator::invalidate() 125 { 126 delete m_propertyNames; 106 127 m_object = 0; 107 128 m_propertyNames = 0; 108 129 } 109 130 110 JSPropertyNameIterator::~JSPropertyNameIterator() 111 { 112 delete m_propertyNames; 113 } 114 115 116 JSPropertyNameIterator* JSPropertyNameIterator::create(ExecState* exec, JSValue* v) 117 { 118 if (v->isUndefinedOrNull()) 119 return new JSPropertyNameIterator(0, 0, 0); 120 121 JSObject* o = v->toObject(exec); 122 PropertyNameArray propertyNames; 123 o->getPropertyNames(exec, propertyNames); 124 size_t numProperties = propertyNames.size(); 125 return new JSPropertyNameIterator(o, propertyNames.releaseIdentifiers(), numProperties); 126 } 127 128 } 131 } // namespace KJS
Note:
See TracChangeset
for help on using the changeset viewer.