Changeset 26715 in webkit for trunk/JavaScriptCore/kjs/function.cpp
- Timestamp:
- Oct 17, 2007, 2:01:27 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/function.cpp
r26690 r26715 49 49 // ----------------------------- FunctionImp ---------------------------------- 50 50 51 const ClassInfo FunctionImp::info = {"Function", &InternalFunctionImp::info, 0, 0}; 52 53 FunctionImp::FunctionImp(ExecState* exec, const Identifier& n, FunctionBodyNode* b) 54 : InternalFunctionImp(static_cast<FunctionPrototype*> 55 (exec->lexicalInterpreter()->builtinFunctionPrototype()), n) 51 const ClassInfo FunctionImp::info = { "Function", &InternalFunctionImp::info, 0, 0 }; 52 53 FunctionImp::FunctionImp(ExecState* exec, const Identifier& name, FunctionBodyNode* b, const ScopeChain& sc) 54 : InternalFunctionImp(static_cast<FunctionPrototype*>(exec->lexicalInterpreter()->builtinFunctionPrototype()), name) 56 55 , body(b) 56 , _scope(sc) 57 57 { 58 58 } … … 64 64 } 65 65 66 FunctionImp::~FunctionImp()67 {68 }69 70 66 JSValue* FunctionImp::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args) 71 67 { … … 74 70 // enter a new execution context 75 71 Context ctx(globalObj, exec->dynamicInterpreter(), thisObj, body.get(), 76 codeType(), exec->context(), this, &args);72 FunctionCode, exec->context(), this, &args); 77 73 ExecState newExec(exec->dynamicInterpreter(), &ctx); 78 74 if (exec->hadException()) … … 80 76 ctx.setExecState(&newExec); 81 77 82 // assign user supplied arguments to parameters83 78 passInParameters(&newExec, args); 84 // add variable declarations (initialized to undefined)85 79 processVarDecls(&newExec); 86 80 … … 89 83 int lineno = -1; 90 84 if (dbg) { 91 if (inherits(&DeclaredFunctionImp::info)) { 92 sid = static_cast<DeclaredFunctionImp*>(this)->body->sourceId(); 93 lineno = static_cast<DeclaredFunctionImp*>(this)->body->firstLine(); 94 } 85 sid = body->sourceId(); 86 lineno = body->firstLine(); 95 87 96 88 bool cont = dbg->callEvent(&newExec,sid,lineno,this,args); … … 113 105 114 106 if (dbg) { 115 if (inherits(&DeclaredFunctionImp::info)) 116 lineno = static_cast<DeclaredFunctionImp*>(this)->body->lastLine(); 107 lineno = body->lastLine(); 117 108 118 109 if (comp.complType() == Throw) … … 147 138 variable->put(exec, parameters[i], args[i], DontDelete); 148 139 } 149 }150 151 void FunctionImp::processVarDecls(ExecState*)152 {153 140 } 154 141 … … 256 243 } 257 244 258 // ------------------------------ DeclaredFunctionImp --------------------------259 260 // ### is "Function" correct here?261 const ClassInfo DeclaredFunctionImp::info = {"Function", &FunctionImp::info, 0, 0};262 263 DeclaredFunctionImp::DeclaredFunctionImp(ExecState* exec, const Identifier& n,264 FunctionBodyNode* b, const ScopeChain& sc)265 : FunctionImp(exec, n, b)266 {267 setScope(sc);268 }269 270 bool DeclaredFunctionImp::implementsConstruct() const271 {272 return true;273 }274 275 245 // ECMA 13.2.2 [[Construct]] 276 JSObject* DeclaredFunctionImp::construct(ExecState* exec, const List& args)246 JSObject* FunctionImp::construct(ExecState* exec, const List& args) 277 247 { 278 248 JSObject* proto; … … 293 263 } 294 264 295 Completion DeclaredFunctionImp::execute(ExecState* exec)265 Completion FunctionImp::execute(ExecState* exec) 296 266 { 297 267 Completion result = body->execute(exec); … … 302 272 } 303 273 304 void DeclaredFunctionImp::processVarDecls(ExecState* exec)274 void FunctionImp::processVarDecls(ExecState* exec) 305 275 { 306 276 body->processDeclarations(exec); … … 525 495 { 526 496 putDirect(exec->propertyNames().length, len, DontDelete|ReadOnly|DontEnum); 527 }528 529 CodeType GlobalFuncImp::codeType() const530 {531 return id == Eval ? EvalCode : codeType();532 497 } 533 498
Note:
See TracChangeset
for help on using the changeset viewer.