Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Issue 12042053: Get rid of unneeded Future.immediate() calls. (Closed)

Created:
7 years, 11 months ago by Bob Nystrom
Modified:
7 years, 11 months ago
Reviewers:
Alan Knight
CC:
reviews_dartlang.org, nweiz
Visibility:
Public.

Description

Get rid of unneeded Future.immediate() calls. Future.then() will now implicitly wrap the callback result in a future if it isn't one, so this manual wrapping can be removed. Also take advantage of the fact that Future.immediate() is always async now and remove some workarounds. Finally, noticed there were two copies of the git-related code floating around so killed the old one. Committed: https://code.google.com/p/dart/source/detail?r=17519

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+37 lines, -116 lines) Patch
M utils/pub/command_uploader.dart View 1 chunk +1 line, -1 line 0 comments Download
M utils/pub/entrypoint.dart View 7 chunks +8 lines, -8 lines 2 comments Download
M utils/pub/git.dart View 3 chunks +7 lines, -8 lines 0 comments Download
M utils/pub/git_source.dart View 1 chunk +2 lines, -2 lines 0 comments Download
M utils/pub/http.dart View 1 chunk +1 line, -3 lines 0 comments Download
M utils/pub/io.dart View 4 chunks +2 lines, -66 lines 0 comments Download
M utils/pub/oauth2.dart View 3 chunks +3 lines, -4 lines 0 comments Download
M utils/pub/pub.dart View 1 chunk +1 line, -3 lines 0 comments Download
M utils/pub/system_cache.dart View 1 chunk +1 line, -1 line 0 comments Download
M utils/pub/validator.dart View 1 chunk +2 lines, -7 lines 0 comments Download
M utils/pub/validator/lib.dart View 1 chunk +1 line, -1 line 0 comments Download
M utils/pub/validator/name.dart View 1 chunk +1 line, -1 line 0 comments Download
M utils/tests/pub/test_pub.dart View 4 chunks +7 lines, -11 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Bob Nystrom
Yay making code cleaner!
7 years, 11 months ago (2013-01-23 18:45:57 UTC) #1
Alan Knight
lgtm, one tiny style nit that's really just a matter of opinion. https://codereview.chromium.org/12042053/diff/1/utils/pub/entrypoint.dart File utils/pub/entrypoint.dart ...
7 years, 11 months ago (2013-01-24 00:03:20 UTC) #2
Bob Nystrom
7 years, 11 months ago (2013-01-24 00:57:42 UTC) #3
Thanks!

https://codereview.chromium.org/12042053/diff/1/utils/pub/entrypoint.dart
File utils/pub/entrypoint.dart (right):

https://codereview.chromium.org/12042053/diff/1/utils/pub/entrypoint.dart#new...
utils/pub/entrypoint.dart:77: if (!exists) return;
On 2013/01/24 00:03:20, Alan Knight wrote:
> Being fussy, but seeing as this isn't a void function it seems clearer to me
to
> explicitly say "return null" than just "return".

The intent here is to exit the function and not exit with a value. You'll note
the following then() just has _ for the parameter, so this callback doesn't
actually return anything. So I figured "return" was closer to the original
intent.

Or, said another way, if this code didn't have to deal with async shenanigans,
this would just be a bare "return" so I figured I'd do that in the async form
too since I can.

Powered by Google App Engine
This is Rietveld 408576698