Changeset 34578 in webkit for trunk/JavaScriptCore/kjs/function.cpp
- Timestamp:
- Jun 15, 2008, 7:19:08 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/function.cpp
r34412 r34578 56 56 namespace KJS { 57 57 58 // ----------------------------- FunctionImp----------------------------------59 60 const ClassInfo FunctionImp::info = { "Function", &InternalFunctionImp::info, 0, 0 };61 62 FunctionImp::FunctionImp(ExecState* exec, const Identifier& name, FunctionBodyNode* b, ScopeChainNode* scopeChain)58 // ----------------------------- JSFunction ---------------------------------- 59 60 const ClassInfo JSFunction::info = { "Function", &InternalFunctionImp::info, 0, 0 }; 61 62 JSFunction::JSFunction(ExecState* exec, const Identifier& name, FunctionBodyNode* b, ScopeChainNode* scopeChain) 63 63 : InternalFunctionImp(exec->lexicalGlobalObject()->functionPrototype(), name) 64 64 , body(b) … … 67 67 } 68 68 69 void FunctionImp::mark()69 void JSFunction::mark() 70 70 { 71 71 InternalFunctionImp::mark(); … … 74 74 } 75 75 76 CallType FunctionImp::getCallData(CallData& callData)76 CallType JSFunction::getCallData(CallData& callData) 77 77 { 78 78 callData.js.functionBody = body.get(); … … 81 81 } 82 82 83 JSValue* FunctionImp::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)83 JSValue* JSFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args) 84 84 { 85 85 JSValue* exception = 0; … … 100 100 } 101 101 102 JSValue* FunctionImp::argumentsGetter(ExecState* exec, const Identifier&, const PropertySlot& slot)103 { 104 FunctionImp* thisObj = static_cast<FunctionImp*>(slot.slotBase());102 JSValue* JSFunction::argumentsGetter(ExecState* exec, const Identifier&, const PropertySlot& slot) 103 { 104 JSFunction* thisObj = static_cast<JSFunction*>(slot.slotBase()); 105 105 ASSERT(exec->machine()); 106 106 return exec->machine()->retrieveArguments(exec, thisObj); 107 107 } 108 108 109 JSValue* FunctionImp::callerGetter(ExecState* exec, const Identifier&, const PropertySlot& slot)110 { 111 FunctionImp* thisObj = static_cast<FunctionImp*>(slot.slotBase());109 JSValue* JSFunction::callerGetter(ExecState* exec, const Identifier&, const PropertySlot& slot) 110 { 111 JSFunction* thisObj = static_cast<JSFunction*>(slot.slotBase()); 112 112 ASSERT(exec->machine()); 113 113 return exec->machine()->retrieveCaller(exec, thisObj); 114 114 } 115 115 116 JSValue* FunctionImp::lengthGetter(ExecState*, const Identifier&, const PropertySlot& slot)117 { 118 FunctionImp* thisObj = static_cast<FunctionImp*>(slot.slotBase());116 JSValue* JSFunction::lengthGetter(ExecState*, const Identifier&, const PropertySlot& slot) 117 { 118 JSFunction* thisObj = static_cast<JSFunction*>(slot.slotBase()); 119 119 return jsNumber(thisObj->body->parameters().size()); 120 120 } 121 121 122 bool FunctionImp::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)122 bool JSFunction::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) 123 123 { 124 124 if (propertyName == exec->propertyNames().arguments) { … … 140 140 } 141 141 142 void FunctionImp::put(ExecState* exec, const Identifier& propertyName, JSValue* value)142 void JSFunction::put(ExecState* exec, const Identifier& propertyName, JSValue* value) 143 143 { 144 144 if (propertyName == exec->propertyNames().arguments || propertyName == exec->propertyNames().length) … … 147 147 } 148 148 149 bool FunctionImp::deleteProperty(ExecState* exec, const Identifier& propertyName)149 bool JSFunction::deleteProperty(ExecState* exec, const Identifier& propertyName) 150 150 { 151 151 if (propertyName == exec->propertyNames().arguments || propertyName == exec->propertyNames().length) … … 161 161 * function f2(x, x): getParameterName(0) --> null 162 162 */ 163 Identifier FunctionImp::getParameterName(int index)163 Identifier JSFunction::getParameterName(int index) 164 164 { 165 165 Vector<Identifier>& parameters = body->parameters(); … … 180 180 181 181 // ECMA 13.2.2 [[Construct]] 182 ConstructType FunctionImp::getConstructData(ConstructData& constructData)182 ConstructType JSFunction::getConstructData(ConstructData& constructData) 183 183 { 184 184 constructData.js.functionBody = body.get(); … … 187 187 } 188 188 189 JSObject* FunctionImp::construct(ExecState* exec, const List& args)189 JSObject* JSFunction::construct(ExecState* exec, const List& args) 190 190 { 191 191 JSObject* proto; … … 221 221 // isn't stored in the activation object. 222 222 223 IndexToNameMap::IndexToNameMap( FunctionImp* func, const List& args)223 IndexToNameMap::IndexToNameMap(JSFunction* func, const List& args) 224 224 { 225 225 _map = new Identifier[args.size()]; … … 279 279 280 280 // ECMA 10.1.8 281 Arguments::Arguments(ExecState* exec, FunctionImp* func, const List& args, JSActivation* act)281 Arguments::Arguments(ExecState* exec, JSFunction* func, const List& args, JSActivation* act) 282 282 : JSObject(exec->lexicalGlobalObject()->objectPrototype()) 283 283 , _activationObject(act)
Note:
See TracChangeset
for help on using the changeset viewer.