Skip to content

Commit

Permalink
Update mistaken return from .catch().
Browse files Browse the repository at this point in the history
  • Loading branch information
slightlyoff committed May 14, 2013
1 parent 543d7db commit df29df2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions polyfill/src/Future.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,16 @@ Future.prototype = Object.create(null, {
wrap(onreject, r, "reject"), f);
});
}),
// FIXME(slightlyoff): it seems that returning self is a design error!
"catch": _public(function(onreject) {
var f = this;
return new Future(function(r) {
addCallbacks(null, wrap(onreject, r, "reject"), f);
});
}),
"done": _public(function(onaccept, onreject) {
return addCallbacks(onaccept, onreject, this);
}),
"catch": _public(function(onreject) {
return addCallbacks(null, onreject, this);
}),
});

//
Expand Down
4 changes: 2 additions & 2 deletions polyfill/tests/Future-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ t.add("Future", [
t.t(f.done() === f);
},

function catch_returns_self() {
function catch_does_not_return_self() {
var f = new Future();
t.t(f.catch() === f);
t.t(f.catch() !== f);
},

async("Values forward correctly", function(d) {
Expand Down

0 comments on commit df29df2

Please sign in to comment.