Show
Ignore:
Timestamp:
08/18/08 11:14:49 (5 months ago)
Author:
odole
Message:

merge with webkit revision 35814

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/JavaScriptCore/kjs/FunctionPrototype.cpp

    r414 r440  
    3030namespace KJS { 
    3131 
     32ASSERT_CLASS_FITS_IN_CELL(FunctionPrototype); 
     33 
    3234static JSValue* functionProtoFuncToString(ExecState*, JSObject*, JSValue*, const ArgList&); 
    3335static JSValue* functionProtoFuncApply(ExecState*, JSObject*, JSValue*, const ArgList&); 
     
    3537 
    3638FunctionPrototype::FunctionPrototype(ExecState* exec) 
     39    : InternalFunction(exec) 
    3740{ 
    3841    putDirect(exec->propertyNames().length, jsNumber(exec, 0), DontDelete | ReadOnly | DontEnum); 
    3942 
    40     putDirectFunction(new (exec) PrototypeFunction(exec, this, 0, exec->propertyNames().toString, functionProtoFuncToString), DontEnum); 
    41     putDirectFunction(new (exec) PrototypeFunction(exec, this, 2, exec->propertyNames().apply, functionProtoFuncApply), DontEnum); 
    42     putDirectFunction(new (exec) PrototypeFunction(exec, this, 1, exec->propertyNames().call, functionProtoFuncCall), DontEnum); 
     43    putDirectFunction(exec, new (exec) PrototypeFunction(exec, this, 0, exec->propertyNames().toString, functionProtoFuncToString), DontEnum); 
     44    putDirectFunction(exec, new (exec) PrototypeFunction(exec, this, 2, exec->propertyNames().apply, functionProtoFuncApply), DontEnum); 
     45    putDirectFunction(exec, new (exec) PrototypeFunction(exec, this, 1, exec->propertyNames().call, functionProtoFuncCall), DontEnum); 
    4346} 
    4447 
     
    5962JSValue* functionProtoFuncToString(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 
    6063{ 
    61     if (!thisValue->isObject(&InternalFunction::info)) 
    62         return throwError(exec, TypeError); 
    63  
    64     InternalFunction* function = static_cast<InternalFunction*>(thisValue); 
    65  
    66     if (function->inherits(&JSFunction::info)) { 
    67         JSFunction* fi = static_cast<JSFunction*>(thisValue); 
    68         return jsString(exec, "function " + fi->functionName().ustring() + "(" + fi->m_body->paramString() + ") " + fi->m_body->toSourceString()); 
     64    if (thisValue->isObject(&JSFunction::info)) { 
     65        JSFunction* function = static_cast<JSFunction*>(thisValue); 
     66        return jsString(exec, "function " + function->name(exec) + "(" + function->m_body->paramString() + ") " + function->m_body->toSourceString()); 
    6967    } 
    7068 
    71     return jsString(exec, "function " + function->functionName().ustring() + "() {\n    [native code]\n}"); 
     69    if (thisValue->isObject(&InternalFunction::info)) { 
     70        InternalFunction* function = static_cast<InternalFunction*>(thisValue); 
     71        return jsString(exec, "function " + function->name(exec) + "() {\n    [native code]\n}"); 
     72    } 
     73 
     74    return throwError(exec, TypeError); 
    7275} 
    7376