Logo Search packages:      
Sourcecode: osb-jscore version File versions  Download package

Value KJS::Object::call ( ExecState exec,
Object thisObj,
const List args 
)

Calls this object as if it is a function.

Note: This function should not be called if implementsCall() returns false, in which case it will result in an assertion failure.

See ECMA 8.6.2.3

Parameters:
exec The current execution state
thisObj The obj to be used as "this" within function execution. Note that in most cases this will be different from the C++ "this" object. For example, if the ECMAScript code "window.location.toString()" is executed, call() will be invoked on the C++ object which implements the toString method, with the thisObj being window.location
args List of arguments to be passed to the function
Returns:
The return value from the function

Definition at line 55 of file object.cpp.

References KJS::Error::create(), and KJS::ExecState::setException().

{ 
#if KJS_MAX_STACK > 0
  static int depth = 0; // sum of all concurrent interpreters
  if (++depth > KJS_MAX_STACK) {
    --depth;
    Object err = Error::create(exec, RangeError,
                               "Maximum call stack size exceeded.");
    exec->setException(err);
    return err;
  }
#endif

  Value ret = imp()->call(exec,thisObj,args); 

#if KJS_MAX_STACK > 0
  --depth;
#endif

  return ret;
}


Generated by  Doxygen 1.6.0   Back to index