fix constructor spread optimisation - thanks @zloirock

This commit is contained in:
Sebastian McKenzie 2014-11-23 01:16:09 +11:00
parent 5a96c2e015
commit e4a3d222d6
3 changed files with 9 additions and 5 deletions

View File

@ -1,7 +1,11 @@
# 1.13.1
* Fix constructor spread optimisation. Thanks [@zloirock](https://github.com/zloirock).
# 1.13.0
* Put experimental ES7 features behind a flag `--experimental` and `experimental` option.
* Constructor speed performance increase. Thanks [@RReverser](https://github.com/RReverser).
* Constructor spread performance increase. Thanks [@RReverser](https://github.com/RReverser).
* Use `self` instead of `window` in the optional 6to5 runtime. Thanks [@RReverser](https://github.com/RReverser).
# 1.12.26

View File

@ -1,5 +1,5 @@
(function (Constructor, args) {
var instance = Object.create(Constructor.prototype);
Constructor.apply(instance, args);
return instance;
var result = Constructor.apply(instance, args);
return result != null && (typeof result == "object" || typeof result == "function") ? result : instance;
});

View File

@ -3,9 +3,9 @@
var _applyConstructor = function (Constructor, args) {
var instance = Object.create(Constructor.prototype);
Constructor.apply(instance, args);
var result = Constructor.apply(instance, args);
return instance;
return result != null && (typeof result == "object" || typeof result == "function") ? result : instance;
};
_applyConstructor(Numbers, Array.from(nums));