19. Языки и транспиллеры
— Dart от Google
— TypeScript от Microsoft
— flow или JSX от Facebook
— ECMAScript 2015
— ECMAScript 2016
19
20. r
length Math PI r
s Math PI r r
circle
// Пример кода с использованием ECMAScript 2015
class Circle extends Figure {
constructor( ) {
super();
this. = 2 * . * ;
this. = . * * ;
}
}
var = new Circle(10);
21. _get _x _x2 _x3
_again
_function _again
object _x
property _x2
receiver _x3
_again
object object Function prototype
desc Object object property
desc undefined
parent Object object
parent
undefined
_x parent
_x2 property
_x3 receiver
_again
desc parent undefined
_function
desc
desc value
getter desc
getter undefined
undefined
getter receiver
instance Constructor
instance
subClass superClass
superClass superClass
superClass
subClass prototype Object superClass superClass prototype
constructor
value subClass
enumerable
writable
configurable
superClass Object setPrototypeOf Object subClass superClass subClass __proto__ superClass
Circle _Figure
Circle _Figure
r
Circle
Object Circle prototype
length Math PI r
s Math PI r r
Circle
Figure
circle
"use strict";
var = function get( , , ) {
var = true;
: while ( ) {
var = ,
= ,
= ;
= false;
if ( === null) = . ;
var = .getOwnPropertyDescriptor( , );
if ( === ) {
var = .getPrototypeOf( );
if ( === null) {
return ;
} else {
= ;
= ;
= ;
= true;
= = ;
continue ;
}
} else if ("value" in ) {
return . ;
} else {
var = .get;
if ( === ) {
return ;
}
return .call( );
}
}
};
function _classCallCheck( , ) {
if (!( instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _inherits( , ) {
if (typeof !== "function" && !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof );
}
. = .create( && . , {
: {
: ,
: false,
: true,
: true
}
});
if ( ) . ? .setPrototypeOf( , ) : . = ;
}
var = (function( ) {
_inherits( , );
function Circle( ) {
_classCallCheck(this, );
_get( .getPrototypeOf( . ), "constructor", this).call(this);
this. = 2 * . * ;
this. = . * * ;
}
return ;
})( );
var = new Circle(10);