23.06.2015 Views

TypeScript Language Specification v1.5

TypeScript Language Specification v1.5

TypeScript Language Specification v1.5

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

In addition, the '__extends' function below is emitted at the beginning of the JavaScript source file. It<br />

copies all properties from the base constructor function object to the derived constructor function object<br />

(in order to inherit static members), and appropriately establishes the 'prototype' property of the derived<br />

constructor function object.<br />

var __extends = this.__extends || function(d, b) {<br />

for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];<br />

function f() { this.constructor = d; }<br />

f.prototype = b.prototype;<br />

d.prototype = new f();<br />

}<br />

BaseClassName is the class name specified in the extends clause.<br />

If the class has no explicitly declared constructor, the SuperCallStatement takes the form<br />

_super.apply(this, arguments);<br />

Otherwise the SuperCallStatement is present if the constructor function is required to start with a super<br />

call, as discussed in section 8.3.2, and takes the form<br />

_super.call(this, )<br />

where SuperCallArguments is the argument list specified in the super call. Note that this call precedes the<br />

code generated for parameter properties and member variables with initializers. Super calls elsewhere in<br />

the constructor generate similar code, but the code generated for such calls will be part of the<br />

ConstructorStatements section.<br />

A super property access in the constructor, an instance member function, or an instance member accessor<br />

generates JavaScript equivalent to<br />

_super.prototype.<br />

where PropertyName is the name of the referenced base class property. When the super property access<br />

appears in a function call, the generated JavaScript is equivalent to<br />

_super.prototype..call(this, )<br />

where Arguments is the code generated for the argument list specified in the function call.<br />

A super property access in a static member function or a static member accessor generates JavaScript<br />

equivalent to<br />

127

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!