Ignore:
Timestamp:
May 21, 2008, 6:20:45 PM (17 years ago)
Author:
[email protected]
Message:

Merge squirrelfish branch into trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/function_object.cpp

    r33038 r33979  
    7171    if (thisObj->inherits(&FunctionImp::info)) {
    7272        FunctionImp* fi = static_cast<FunctionImp*>(thisObj);
    73         return jsString("function " + fi->functionName().ustring() + "(" + fi->body->paramString() + ") " + fi->body->toString());
     73        return jsString("function " + fi->functionName().ustring() + "(" + fi->body->paramString() + ") " + fi->body->toSourceString());
    7474    }
    7575
     
    137137}
    138138
    139 bool FunctionObjectImp::implementsConstruct() const
    140 {
    141     return true;
     139ConstructType FunctionObjectImp::getConstructData(ConstructData&)
     140{
     141    return ConstructTypeNative;
    142142}
    143143
     
    163163    int errLine;
    164164    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);
    172167
    173168    // No program node == syntax error - throw a syntax error
     
    176171        // and return it
    177172        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());
    183178
    184179    // parse parameter list. throw syntax error on illegal identifiers
     
    213208    }
    214209 
    215     List consArgs;
    216 
    217210    JSObject* objCons = exec->lexicalGlobalObject()->objectConstructor();
    218211    JSObject* prototype = objCons->construct(exec, exec->emptyList());
Note: See TracChangeset for help on using the changeset viewer.