Esempio n. 1
0
    void ProgramClass::_setExitListener(FunctionObject* f)
    {
        AvmCore *core = this->core();

        // Listeners MUST be functions or null
        if ( core->isNullOrUndefined(f->atom()) )
        {
            f = 0;
        }
        else if (!AvmCore::istype(f->atom(), core->traits.function_itraits))
        {
            toplevel()->argumentErrorClass()->throwError( kInvalidArgumentError, core->toErrorString("Function"));
        }

        exit_callback = f;
    }
	void TraceClass::setListener(ScriptObject* f)
	{
	#ifdef DEBUGGER
		AvmCore *core = this->core();
		if (core->debugger())
		{
			// Listeners MUST be functions or null
			if ( core->isNullOrUndefined(f->atom()) )
			{
				f = 0;
			}
			else if (!AvmCore::istype(f->atom(), core->traits.function_itraits)) 
			{
				toplevel()->argumentErrorClass()->throwError( kInvalidArgumentError, core->toErrorString("Function"));
				return;
			}
			
			//MethodClosure* mc = f->toplevel()->methodClosureClass->create(f->getCallMethodEnv(), f->atom());
			core->debugger()->trace_callback = f;
		}
	#endif /* DEBUGGER */
		(void)f;
	}