#include <as_function.h>

Public Member Functions | |
| virtual | ~as_function () |
| Decrement refcount on the exported interface. | |
| as_function * | to_function () |
| Cast to a as_function, or return NULL. | |
| virtual as_value | operator() (const fn_call &fn)=0 |
| Dispatch. | |
| as_value | call (const fn_call &fn) |
| Alias for operator(). | |
| boost::intrusive_ptr< as_object > | constructInstance (as_environment &env, unsigned nargs, unsigned first_arg_index) |
| Construct an instance of this class. | |
| boost::intrusive_ptr< as_object > | getPrototype () |
| void | extends (as_function &superclass) |
| Make this function a subclass of the given as_function. | |
| virtual bool | isBuiltin () |
| Return true if this is a built-in class. | |
| std::string | get_text_value () const |
Static Public Member Functions | |
| static boost::intrusive_ptr < builtin_function > | getFunctionConstructor () |
| Return the built-in Function constructor. | |
Protected Member Functions | |
| as_function () | |
| Construct a function with a default interface. | |
| as_function (as_object *iface) | |
| Construct a function with given interface (possibly none). | |
In ActionScript, every Function is also a class. The *exported interface* of the class is defined as an 'prototype' member of the function object.
Any instance of the class defined by this function will inherit any member of the class 'prototype'. To have an object inherit from a class you can set it's __proto__ member so to point to the class prototype, ie:
function MyClass() {} MyClass.prototype.doit = function() { trace("doing it"; }
var myobj = new Object; myobj.__proto__ = MyClass.prototype;
The 'prototype' of a class must provide a 'constructor' member, which would point back to the Function object itself, which is used as the constructor, so given the code above you can assert that:
myobj.__proto__.constructor == MyClass
This class will automatically setup the 'prototype' member if not explicitly provided (ie: will set 'constructor' so that it points to the instance).
| virtual gnash::as_function::~as_function | ( | ) | [inline, virtual] |
Decrement refcount on the exported interface.
| gnash::as_function::as_function | ( | ) | [protected] |
Construct a function with a default interface.
The default interface will have derive from Object and have 'this' set as it's 'constructor' member.
| gnash::as_function::as_function | ( | as_object * | iface | ) | [protected] |
Construct a function with given interface (possibly none).
| iface | The interface exported by this class (its 'prototype' member). If NULL, no prototype will be set (this is used for some corner cases like TextField in SWF5 or below). If not NULL, a 'constructor' member will be added to the prototype, pointing to 'this'. |
| as_function* gnash::as_function::to_function | ( | ) | [inline, virtual] |
| boost::intrusive_ptr< as_object > gnash::as_function::constructInstance | ( | as_environment & | env, | |
| unsigned | nargs, | |||
| unsigned | first_arg_index | |||
| ) |
Construct an instance of this class.
Post-conditions:
| env | The environment to use for stack, local variables, registers and scope chain. | |
| nargs | Number of arguments passed to this constructor | |
| first_arg_index | Index of the as_environment stack element to use as first argument. |
| boost::intrusive_ptr< as_object > gnash::as_function::getPrototype | ( | ) |
Get this function's "prototype" member (exported interface).
| void gnash::as_function::extends | ( | as_function & | superclass | ) |
Make this function a subclass of the given as_function.
| virtual bool gnash::as_function::isBuiltin | ( | ) | [inline, virtual] |
| std::string gnash::as_function::get_text_value | ( | ) | const [inline, virtual] |
TODO: check if a user-defined 'toString' will be used when available.
Reimplemented from gnash::as_object.
| boost::intrusive_ptr< builtin_function > gnash::as_function::getFunctionConstructor | ( | ) | [static] |
Return the built-in Function constructor.
1.5.4