Changeset 35807 in webkit for trunk/JavaScriptCore/kjs/InternalFunction.cpp
- Timestamp:
- Aug 17, 2008, 1:23:49 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/InternalFunction.cpp
r35229 r35807 29 29 namespace KJS { 30 30 31 ASSERT_CLASS_FITS_IN_CELL(InternalFunction); 32 31 33 const ClassInfo InternalFunction::info = { "Function", 0, 0, 0 }; 32 34 33 InternalFunction::InternalFunction( )35 InternalFunction::InternalFunction(ExecState* exec) 34 36 { 37 putDirect(exec->propertyNames().name, jsString(exec, exec->propertyNames().nullIdentifier.ustring()), DontDelete | ReadOnly | DontEnum); 35 38 } 36 39 37 InternalFunction::InternalFunction( FunctionPrototype* prototype, const Identifier& name)40 InternalFunction::InternalFunction(ExecState* exec, FunctionPrototype* prototype, const Identifier& name) 38 41 : JSObject(prototype) 39 , m_name(name)40 42 { 43 putDirect(exec->propertyNames().name, jsString(exec, name.ustring()), DontDelete | ReadOnly | DontEnum); 44 } 45 46 const UString& InternalFunction::name(ExecState* exec) 47 { 48 JSValue* v = getDirect(exec->propertyNames().name); 49 ASSERT(v->isString()); 50 return static_cast<JSString*>(v)->value(); 41 51 } 42 52 … … 46 56 } 47 57 48 bool InternalFunction::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)49 {50 if (propertyName == exec->propertyNames().name) {51 slot.setCustom(this, nameGetter);52 return true;53 }54 55 return JSObject::getOwnPropertySlot(exec, propertyName, slot);56 }57 58 void InternalFunction::put(ExecState* exec, const Identifier& propertyName, JSValue* value)59 {60 if (propertyName == exec->propertyNames().name)61 return;62 JSObject::put(exec, propertyName, value);63 }64 65 bool InternalFunction::deleteProperty(ExecState* exec, const Identifier& propertyName)66 {67 if (propertyName == exec->propertyNames().name)68 return false;69 return JSObject::deleteProperty(exec, propertyName);70 }71 72 JSValue* InternalFunction::nameGetter(ExecState* exec, const Identifier&, const PropertySlot& slot)73 {74 InternalFunction* thisObj = static_cast<InternalFunction*>(slot.slotBase());75 return jsString(exec, thisObj->functionName().ustring());76 }77 78 58 } // namespace KJS
Note:
See TracChangeset
for help on using the changeset viewer.