Exemple #1
0
JSValue *FunctionImp::argumentsGetter(ExecState* exec, JSObject*, const Identifier& propertyName, const PropertySlot& slot)
{
  FunctionImp *thisObj = static_cast<FunctionImp *>(slot.slotBase());
  ExecState *context = exec;
  while (context) {
    if (context->function() == thisObj) {
      return static_cast<ActivationImp *>(context->activationObject())->get(exec, propertyName);
    }
    context = context->callingExecState();
  }
  return jsNull();
}
Exemple #2
0
JSValue *FunctionImp::callerGetter(ExecState* exec, JSObject*, const Identifier&, const PropertySlot& slot)
{
    FunctionImp* thisObj = static_cast<FunctionImp*>(slot.slotBase());
    ExecState* context = exec;
    while (context) {
        if (context->function() == thisObj)
            break;
        context = context->callingExecState();
    }

    if (!context)
        return jsNull();

    ExecState* callingContext = context->callingExecState();
    if (!callingContext)
        return jsNull();

    FunctionImp* callingFunction = callingContext->function();
    if (!callingFunction)
        return jsNull();

    return callingFunction;
}