Changeset 10076 in webkit for trunk/JavaScriptCore/bindings/runtime_object.cpp
- Timestamp:
- Aug 6, 2005, 11:17:49 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/bindings/runtime_object.cpp
r9889 r10076 55 55 } 56 56 57 RuntimeObjectImp::RuntimeObjectImp(Bindings::Instance *i, bool oi) : ObjectImp ((ObjectImp *)0)57 RuntimeObjectImp::RuntimeObjectImp(Bindings::Instance *i, bool oi) 58 58 { 59 59 ownsInstance = oi; … … 61 61 } 62 62 63 bool RuntimeObjectImp::getOwnProperty(ExecState *exec, const Identifier& propertyName, Value& result) const 63 Value RuntimeObjectImp::fallbackObjectGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot) 64 { 65 RuntimeObjectImp *thisObj = static_cast<RuntimeObjectImp *>(slot.slotBase()); 66 Bindings::Instance *instance = thisObj->instance; 67 68 instance->begin(); 69 70 Class *aClass = instance->getClass(); 71 Value result = aClass->fallbackObject(exec, instance, propertyName); 72 73 instance->end(); 74 75 return result; 76 } 77 78 Value RuntimeObjectImp::fieldGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot) 79 { 80 RuntimeObjectImp *thisObj = static_cast<RuntimeObjectImp *>(slot.slotBase()); 81 Bindings::Instance *instance = thisObj->instance; 82 83 instance->begin(); 84 85 Class *aClass = instance->getClass(); 86 Field *aField = aClass->fieldNamed(propertyName.ascii(), instance); 87 Value result = instance->getValueOfField(exec, aField); 88 89 instance->end(); 90 91 return result; 92 } 93 94 Value RuntimeObjectImp::methodGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot) 95 { 96 RuntimeObjectImp *thisObj = static_cast<RuntimeObjectImp *>(slot.slotBase()); 97 Bindings::Instance *instance = thisObj->instance; 98 99 instance->begin(); 100 101 Class *aClass = instance->getClass(); 102 MethodList methodList = aClass->methodsNamed(propertyName.ascii(), instance); 103 Value result = Object(new RuntimeMethodImp(exec, propertyName, methodList)); 104 105 instance->end(); 106 107 return result; 108 } 109 110 bool RuntimeObjectImp::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot) 64 111 { 65 112 instance->begin(); … … 68 115 69 116 if (aClass) { 70 // See if the instance ha vea field with the specified name.117 // See if the instance has a field with the specified name. 71 118 Field *aField = aClass->fieldNamed(propertyName.ascii(), instance); 72 119 if (aField) { 73 result = instance->getValueOfField(exec, aField); 120 slot.setCustom(this, fieldGetter); 121 instance->end(); 74 122 return true; 75 123 } else { … … 78 126 MethodList methodList = aClass->methodsNamed(propertyName.ascii(), instance); 79 127 if (methodList.length() > 0) { 80 result = Object(new RuntimeMethodImp(exec, propertyName, methodList)); 128 slot.setCustom(this, methodGetter); 129 instance->end(); 81 130 return true; 82 131 } 83 132 } 84 133 85 if (result.type() == UndefinedType) { 86 // Try a fallback object. 87 result = aClass->fallbackObject(exec, instance, propertyName); 134 // Try a fallback object. 135 if (!aClass->fallbackObject(exec, instance, propertyName).type() != UndefinedType) { 136 slot.setCustom(this, fallbackObjectGetter); 137 instance->end(); 88 138 return true; 89 139 } … … 131 181 } 132 182 133 bool RuntimeObjectImp::hasOwnProperty(ExecState *exec,134 const Identifier &propertyName) const135 {136 bool result = false;137 138 instance->begin();139 140 Field *aField = instance->getClass()->fieldNamed(propertyName.ascii(), instance);141 if (aField) {142 instance->end();143 return true;144 }145 146 MethodList methodList = instance->getClass()->methodsNamed(propertyName.ascii(), instance);147 148 instance->end();149 150 if (methodList.length() > 0)151 return true;152 153 return result;154 }155 156 183 bool RuntimeObjectImp::deleteProperty(ExecState *exec, 157 184 const Identifier &propertyName)
Note:
See TracChangeset
for help on using the changeset viewer.