Skip to content

Commit

Permalink
[BUGFIX beta] Ensures Ember.A is a constructor
Browse files Browse the repository at this point in the history
The recent change to transpilation has made `new A()` break, because
A is an arrow function and arrow functions cannot be constructors. This
is a pretty common pattern in Ember apps and likely constitutes a
breaking change, so this PR fixes it by changing the arrow function to
a normal function.
  • Loading branch information
pzuraq committed Nov 29, 2018
1 parent 7666b70 commit 9181605
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/@ember/-internals/runtime/lib/mixins/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -1641,9 +1641,11 @@ let A;

if (ENV.EXTEND_PROTOTYPES.Array) {
NativeArray.apply(Array.prototype);
A = arr => arr || [];
A = function(arr) {
return arr || [];
};
} else {
A = arr => {
A = function(arr) {
if (!arr) {
arr = [];
}
Expand Down

0 comments on commit 9181605

Please sign in to comment.