inherit super class static properties - fixes #31
This commit is contained in:
1
lib/6to5/templates/class-inherits-properties.js
Normal file
1
lib/6to5/templates/class-inherits-properties.js
Normal file
@@ -0,0 +1 @@
|
||||
CLASS_NAME.__proto__ = SUPER_NAME;
|
||||
@@ -46,7 +46,14 @@ var buildClass = function (node, generateUid) {
|
||||
var returnStatement = body.pop();
|
||||
|
||||
if (superName) {
|
||||
body.push(util.template("inherits", {
|
||||
// inherit prototype
|
||||
body.push(util.template("class-inherits-prototype", {
|
||||
SUPER_NAME: superName,
|
||||
CLASS_NAME: className
|
||||
}, true));
|
||||
|
||||
// inherit static properties
|
||||
body.push(util.template("class-inherits-properties", {
|
||||
SUPER_NAME: superName,
|
||||
CLASS_NAME: className
|
||||
}, true));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "6to5",
|
||||
"description": "Turn ES6 code into vanilla ES5 with source maps and no runtime",
|
||||
"version": "1.7.3",
|
||||
"version": "1.7.4",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://github.com/sebmck/6to5",
|
||||
"repository": {
|
||||
|
||||
@@ -13,5 +13,6 @@ var Test = function (Foo) {
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
Test.__proto__ = Foo;
|
||||
return Test;
|
||||
}(Foo);
|
||||
|
||||
@@ -9,6 +9,7 @@ var BaseController = function (Chaplin) {
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
BaseController.__proto__ = Chaplin.Controller;
|
||||
return BaseController;
|
||||
}(Chaplin);
|
||||
|
||||
@@ -23,5 +24,6 @@ var BaseController2 = function (Chaplin) {
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
BaseController2.__proto__ = Chaplin.Controller.Another;
|
||||
return BaseController2;
|
||||
}(Chaplin);
|
||||
|
||||
@@ -9,6 +9,7 @@ var Q = function(_ref) {
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
Q.__proto__ = _ref;
|
||||
|
||||
return Q;
|
||||
}(function() {});
|
||||
|
||||
@@ -9,5 +9,6 @@ var Test = function (Foo) {
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
Test.__proto__ = Foo;
|
||||
return Test;
|
||||
}(Foo);
|
||||
|
||||
Reference in New Issue
Block a user