ActionScriptSuper

From Gnash Project Wiki

Jump to: navigation, search

'super' is a symbol which is supposedly available inside class method bodies to refer to the superclass.

Observable behaviour of the super object

  1. Super is a special type of object bound to a constructor and to a prototype
  2. Calling this special object yeld a call to the associated constructor
  3. Fetching properties of this special object yeld properties of the associated prototype
  4. Association with the constructor and with the prototype are set when the 'super' object is created, and cannot be changed by ActionScript.
  5. Assigning new members to this special object seems to do nothing (doesn't assign to the associated prototype, nor can be fetched from super itsef)
  6. super.hasOwnProperty() returns true for __proto__, constructor and __constructor__ but could find no other 'own' member, and no way to add to that set (enumerate doesn't return them, even after ASSetPropFlags calls).
  7. typeof(super) returns 'object', but it can be called as a function.

Availability

  1. Available when instantiating a class. This is using 'new CONSTRUCTOR' (ActionNew). In this case the associated constructor will be the base class of CONSTRUCTOR (CONSTRUCTOR.prototype.__constructor__) and the associated prototype will be the prototype (exported interface) of the base class of CONSTRUCTOR (CONSTRUCTOR.prototype.__proto__). Note that if CONSTRUCTOR.prototype.__constructor__ is not available (setting to undefined counts as being defined) the constructor will be derived from the prototype (CONSTRUCTOR.prototype.__proto__.__constructor__) This might be normal lookup. Note that when calling the CONSTRUCTOR function directly, 'super' is undefined.
  2. ActionCallFunction. When calling a function we only know the function name and find out the object that function is defined into. When the function being called is a 'super' we must construct a new super for use inside it that references the super's super class. This would be referencing the __constructor__ and __proto__ members of the super-associated constructor's prototype.
  3. ActionCallMethod. Here we know an object a method of which is called, and the method name.
  4. Construction of MovieClip instances of symbols for which registerClass was called.
  5. Execution of the actionscript method Function.call

References

See Task #7373.