Ignore:
Timestamp:
Jul 16, 2006, 3:17:04 PM (19 years ago)
Author:
ggaren
Message:

Reviewed by Maciej.


  • Added names to functions.


  • Removed GetPrivate/SetPrivate from callbackFunctions and callbackConstructors. The private data idiom is that a JS object stores its native implementation as private data. For functions and constructors, the native implementation is nothing more than the callback they already store, so supporting private data, too, confuses the idiom. If you *really* want, you can still create a custom function with private data.
  • API/JSCallbackConstructor.cpp:
  • API/JSCallbackConstructor.h:
  • API/JSCallbackFunction.cpp: (KJS::JSCallbackFunction::JSCallbackFunction):
  • API/JSCallbackFunction.h:
  • API/JSCallbackObject.cpp: (KJS::JSCallbackObject::staticFunctionGetter):
  • API/JSObjectRef.cpp: (JSObjectMakeFunction): (JSObjectMakeFunctionWithBody): (JSObjectGetPrivate): (JSObjectSetPrivate):
  • API/JSObjectRef.h:
  • API/minidom.c: (main):
  • API/testapi.c: (main):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/JSObjectRef.h

    r15468 r15469  
    387387@abstract Convenience method for creating a JavaScript function with a given callback as its implementation.
    388388@param context The execution context to use.
     389@param name A JSString containing the function's name. This will be used when converting the function to string. Pass NULL to create an anonymous function.
    389390@param callAsFunction The JSObjectCallAsFunctionCallback to invoke when the function is called.
    390391@result A JSObject that is an anonymous function. The object's prototype will be the default function prototype.
    391392*/
    392 JSObjectRef JSObjectMakeFunction(JSContextRef context, JSObjectCallAsFunctionCallback callAsFunction);
     393JSObjectRef JSObjectMakeFunction(JSContextRef context, JSStringRef name, JSObjectCallAsFunctionCallback callAsFunction);
    393394/*!
    394395@function
     
    404405@abstract Creates a function with a given script as its body.
    405406@param context The execution context to use.
    406 @param name A JSString containing the function's name. Pass NULL to create an anonymous function.
     407@param name A JSString containing the function's name. This will be used when converting the function to string. Pass NULL to create an anonymous function.
    407408@param parameterCount An integer count of the number of parameter names in parameterNames.
    408409@param parameterNames A JSString array containing the names of the function's parameters. Pass NULL if parameterCount is 0.
     
    501502@param object A JSObject whose private data you want to get.
    502503@result A void* that points to the object's private data, if the object has private data, otherwise NULL.
    503 @discussion JSObjectGetPrivate and JSObjectSetPrivate only work on objects created by JSObjectMake, JSObjectMakeFunction, and JSObjectMakeConstructor.
    504504*/
    505505void* JSObjectGetPrivate(JSObjectRef object);
     
    510510@param object A JSObject whose private data you want to set.
    511511@param data A void* that points to the object's private data.
    512 @result true if the set operation succeeds, otherwise false.
    513 @discussion JSObjectGetPrivate and JSObjectSetPrivate only work on objects created by JSObjectMake, JSObjectMakeFunction, and JSObjectMakeConstructor.
     512@result true if the object can store private data, otherwise false.
     513@discussion Only custom objects created with a JSClass can store private data.
    514514*/
    515515bool JSObjectSetPrivate(JSObjectRef object, void* data);
Note: See TracChangeset for help on using the changeset viewer.