Changeset 33979 in webkit for trunk/JavaScriptCore/kjs/function_object.cpp
- Timestamp:
- May 21, 2008, 6:20:45 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/function_object.cpp
r33038 r33979 71 71 if (thisObj->inherits(&FunctionImp::info)) { 72 72 FunctionImp* fi = static_cast<FunctionImp*>(thisObj); 73 return jsString("function " + fi->functionName().ustring() + "(" + fi->body->paramString() + ") " + fi->body->toS tring());73 return jsString("function " + fi->functionName().ustring() + "(" + fi->body->paramString() + ") " + fi->body->toSourceString()); 74 74 } 75 75 … … 137 137 } 138 138 139 bool FunctionObjectImp::implementsConstruct() const 140 { 141 return true;139 ConstructType FunctionObjectImp::getConstructData(ConstructData&) 140 { 141 return ConstructTypeNative; 142 142 } 143 143 … … 163 163 int errLine; 164 164 UString errMsg; 165 RefPtr<FunctionBodyNode> functionBody = parser().parse<FunctionBodyNode>(sourceURL, lineNumber, body.data(), body.size(), &sourceId, &errLine, &errMsg); 166 167 // notify debugger that source has been parsed 168 // send empty sourceURL to indicate constructed code 169 Debugger* dbg = exec->dynamicGlobalObject()->debugger(); 170 if (dbg && !dbg->sourceParsed(exec, sourceId, UString(), body, lineNumber, errLine, errMsg)) 171 return new JSObject(); 165 RefPtr<SourceProvider> source = UStringSourceProvider::create(body); 166 RefPtr<FunctionBodyNode> functionBody = parser().parse<FunctionBodyNode>(exec, sourceURL, lineNumber, source, &sourceId, &errLine, &errMsg); 172 167 173 168 // No program node == syntax error - throw a syntax error … … 176 171 // and return it 177 172 return throwError(exec, SyntaxError, errMsg, errLine, sourceId, sourceURL); 178 179 ScopeChain scopeChain;180 scopeChain.push(exec->lexicalGlobalObject());181 182 FunctionImp* fimp = new FunctionImp(exec, functionName, functionBody.get(), scopeChain );173 174 functionBody->setSource(SourceRange(source, 0, source->length())); 175 ScopeChain scopeChain(exec->lexicalGlobalObject()); 176 177 FunctionImp* fimp = new FunctionImp(exec, functionName, functionBody.get(), scopeChain.node()); 183 178 184 179 // parse parameter list. throw syntax error on illegal identifiers … … 213 208 } 214 209 215 List consArgs;216 217 210 JSObject* objCons = exec->lexicalGlobalObject()->objectConstructor(); 218 211 JSObject* prototype = objCons->construct(exec, exec->emptyList());
Note:
See TracChangeset
for help on using the changeset viewer.