Changeset 20310 in webkit for trunk/JavaScriptCore/kjs/function_object.cpp
- Timestamp:
- Mar 18, 2007, 10:43:47 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/function_object.cpp
r20004 r20310 44 44 static const Identifier* callPropertyName = new Identifier("call"); 45 45 46 putDirect( lengthPropertyName, jsNumber(0), DontDelete|ReadOnly|DontEnum);47 putDirectFunction(new FunctionProtoFunc(exec, this, FunctionProtoFunc::ToString, 0, toStringPropertyName), DontEnum);46 putDirect(exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum); 47 putDirectFunction(new FunctionProtoFunc(exec, this, FunctionProtoFunc::ToString, 0, exec->propertyNames().toString), DontEnum); 48 48 putDirectFunction(new FunctionProtoFunc(exec, this, FunctionProtoFunc::Apply, 2, *applyPropertyName), DontEnum); 49 49 putDirectFunction(new FunctionProtoFunc(exec, this, FunctionProtoFunc::Call, 1, *callPropertyName), DontEnum); … … 62 62 // ------------------------------ FunctionProtoFunc ------------------------- 63 63 64 FunctionProtoFunc::FunctionProtoFunc(ExecState* , FunctionPrototype* funcProto, int i, int len, const Identifier& name)64 FunctionProtoFunc::FunctionProtoFunc(ExecState* exec, FunctionPrototype* funcProto, int i, int len, const Identifier& name) 65 65 : InternalFunctionImp(funcProto, name) 66 66 , id(i) 67 67 { 68 putDirect( lengthPropertyName, len, DontDelete|ReadOnly|DontEnum);69 } 70 71 JSValue *FunctionProtoFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const List &args)72 { 73 JSValue *result = NULL;68 putDirect(exec->propertyNames().length, len, DontDelete | ReadOnly | DontEnum); 69 } 70 71 JSValue* FunctionProtoFunc::callAsFunction(ExecState* exec, JSObject* thisObj, const List &args) 72 { 73 JSValue* result = NULL; 74 74 75 75 switch (id) { … … 114 114 115 115 JSObject *argArrayObj = static_cast<JSObject *>(argArray); 116 unsigned int length = argArrayObj->get(exec, lengthPropertyName)->toUInt32(exec);116 unsigned int length = argArrayObj->get(exec, exec->propertyNames().length)->toUInt32(exec); 117 117 for (unsigned int i = 0; i < length; i++) 118 118 applyArgs.append(argArrayObj->get(exec,i)); … … 147 147 // ------------------------------ FunctionObjectImp ---------------------------- 148 148 149 FunctionObjectImp::FunctionObjectImp(ExecState* , FunctionPrototype* funcProto)149 FunctionObjectImp::FunctionObjectImp(ExecState* exec, FunctionPrototype* funcProto) 150 150 : InternalFunctionImp(funcProto) 151 151 { 152 putDirect( prototypePropertyName, funcProto, DontEnum|DontDelete|ReadOnly);152 putDirect(exec->propertyNames().prototype, funcProto, DontEnum|DontDelete|ReadOnly); 153 153 154 154 // no. of arguments for constructor 155 putDirect( lengthPropertyName, jsNumber(1), ReadOnly|DontDelete|DontEnum);155 putDirect(exec->propertyNames().length, jsNumber(1), ReadOnly|DontDelete|DontEnum); 156 156 } 157 157 … … 244 244 List consArgs; 245 245 246 JSObject *objCons = exec->lexicalInterpreter()->builtinObject();247 JSObject *prototype = objCons->construct(exec,List::empty());248 prototype->put(exec, constructorPropertyName, fimp, DontEnum|DontDelete|ReadOnly);249 fimp->put(exec, prototypePropertyName, prototype, Internal|DontDelete);246 JSObject* objCons = exec->lexicalInterpreter()->builtinObject(); 247 JSObject* prototype = objCons->construct(exec,List::empty()); 248 prototype->put(exec, exec->propertyNames().constructor, fimp, DontEnum|DontDelete|ReadOnly); 249 fimp->put(exec, exec->propertyNames().prototype, prototype, Internal|DontDelete); 250 250 return fimp; 251 251 }
Note:
See TracChangeset
for help on using the changeset viewer.