/**
     * Function.prototype.call()
     */
	Atom FunctionObject::AS3_call(Atom thisArg, Atom *argv, int argc)
	{
		thisArg = get_coerced_receiver(thisArg);

		if (argc > 0) 
		{
			return _call->coerceEnter(thisArg, argc, argv);
		}
		else
		{
			return _call->coerceEnter(thisArg);
		}
	}
Beispiel #2
0
	/**
     * Function.prototype.apply()
     */
	Atom FunctionObject::AS3_apply(Atom thisArg, Atom argArray)
	{
		thisArg = get_coerced_receiver(thisArg);

		// when argArray == undefined or null, same as not being there at all
		// see Function/e15_3_4_3_1.as 
	
		if (!AvmCore::isNullOrUndefined(argArray))
		{
			AvmCore* core = this->core();

			// FIXME: why not declare argArray as Array in Function.as?
			if (!AvmCore::istype(argArray, ARRAY_TYPE))
				toplevel()->throwTypeError(kApplyError);

			return _call->coerceEnter(thisArg, (ArrayObject*)AvmCore::atomToScriptObject(argArray));
		}
		else
		{
			return _call->coerceEnter(thisArg);
		}
	}
Beispiel #3
0
	Atom FunctionObject::call(int argc, Atom* argv)
	{
		argv[0] = get_coerced_receiver(argv[0]);
		return _call->coerceEnter(argc, argv);
	}