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

Issue 362153002: Transform functions marked as async (Closed)

Created:
6 years, 5 months ago by Michael Lippautz (Google)
Modified:
6 years, 4 months ago
Reviewers:
hausner, Ivan Posva
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Transform functions marked as async In a nutshell: foo(params) async { <body> return result; } transforms to foo(params) async { var c = new Completer(); var async_body = () { <body> completer.complete(result); } new Future(async_body); return c.future; } BUG= R=hausner@google.com Committed: https://code.google.com/p/dart/source/detail?r=38681

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : getters and setters #

Total comments: 22

Patch Set 4 : first round of comments #

Total comments: 4

Patch Set 5 : #

Patch Set 6 : reworked #

Patch Set 7 : #

Total comments: 4

Patch Set 8 : #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+429 lines, -7 lines) Patch
M runtime/vm/ast.h View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M runtime/vm/object.h View 1 2 3 4 5 6 6 chunks +20 lines, -0 lines 2 comments Download
M runtime/vm/object.cc View 1 2 3 4 5 5 chunks +13 lines, -1 line 0 comments Download
M runtime/vm/parser.h View 1 2 3 4 5 3 chunks +8 lines, -0 lines 0 comments Download
M runtime/vm/parser.cc View 1 2 3 4 5 6 7 18 chunks +246 lines, -3 lines 2 comments Download
M runtime/vm/raw_object.h View 1 2 3 4 5 2 chunks +6 lines, -1 line 0 comments Download
M runtime/vm/raw_object_snapshot.cc View 1 2 3 4 5 2 chunks +2 lines, -2 lines 0 comments Download
M runtime/vm/symbols.h View 1 2 3 4 5 1 chunk +9 lines, -0 lines 0 comments Download
A tests/language/async_test.dart View 1 2 3 4 5 6 1 chunk +121 lines, -0 lines 0 comments Download
M tests/language/language.status View 1 2 3 4 5 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 11 (0 generated)
Michael Lippautz (Google)
not ready yet. maybe a first round of comments?
6 years, 5 months ago (2014-07-10 23:22:18 UTC) #1
hausner
First set of comments. I like that you were able to keep the meat of ...
6 years, 5 months ago (2014-07-11 20:18:41 UTC) #2
Michael Lippautz (Google)
Addressed comments. Still missing tests. For the record (as discussed offline): For async it is ...
6 years, 5 months ago (2014-07-11 23:40:45 UTC) #3
hausner
Looking forward to seeing the tests. https://codereview.chromium.org/362153002/diff/60001/runtime/vm/parser.cc File runtime/vm/parser.cc (right): https://codereview.chromium.org/362153002/diff/60001/runtime/vm/parser.cc#newcode2904 runtime/vm/parser.cc:2904: closure.set_is_synthetic_container(true); I can't ...
6 years, 5 months ago (2014-07-12 00:05:24 UTC) #4
Michael Lippautz (Google)
Added tests. Async getters/operators are a thing. For setters the situation is currently being discussed. ...
6 years, 5 months ago (2014-07-14 20:22:48 UTC) #5
Michael Lippautz (Google)
PTAL All parsing/processing is hidden behind the flag --enable_async. The generated AST now follows what ...
6 years, 4 months ago (2014-07-28 21:23:19 UTC) #6
hausner
Looks pretty solid to me now. Ship it! LGTM. https://codereview.chromium.org/362153002/diff/220001/runtime/vm/parser.cc File runtime/vm/parser.cc (right): https://codereview.chromium.org/362153002/diff/220001/runtime/vm/parser.cc#newcode5568 runtime/vm/parser.cc:5568: ...
6 years, 4 months ago (2014-07-29 00:35:13 UTC) #7
Michael Lippautz (Google)
https://codereview.chromium.org/362153002/diff/220001/runtime/vm/parser.cc File runtime/vm/parser.cc (right): https://codereview.chromium.org/362153002/diff/220001/runtime/vm/parser.cc#newcode5568 runtime/vm/parser.cc:5568: // Replace the current function's body with the async ...
6 years, 4 months ago (2014-07-29 17:15:33 UTC) #8
Michael Lippautz (Google)
Committed patchset #8 manually as r38681 (presubmit successful).
6 years, 4 months ago (2014-07-29 17:16:10 UTC) #9
Ivan Posva
DBC -ip https://codereview.chromium.org/362153002/diff/240001/runtime/vm/object.h File runtime/vm/object.h (right): https://codereview.chromium.org/362153002/diff/240001/runtime/vm/object.h#newcode2070 runtime/vm/object.h:2070: public BitField<RawFunction::AsyncModifier, kModifierPos, 2> {}; // NOLINT ...
6 years, 4 months ago (2014-07-29 21:10:33 UTC) #10
Michael Lippautz (Google)
6 years, 4 months ago (2014-07-29 21:43:50 UTC) #11
Message was sent while issue was closed.
https://codereview.chromium.org/362153002/diff/240001/runtime/vm/object.h
File runtime/vm/object.h (right):

https://codereview.chromium.org/362153002/diff/240001/runtime/vm/object.h#new...
runtime/vm/object.h:2070: public BitField<RawFunction::AsyncModifier,
kModifierPos, 2> {};  // NOLINT
On 2014/07/29 21:10:33, Ivan Posva wrote:
> AsyncModifier is only two states, why do we encode it in two bits here?

In the end it will be: none,async,sync*,async*. I suspect that we need to
distinguish them.

(We already need 32 bits for the tag.)

https://codereview.chromium.org/362153002/diff/240001/runtime/vm/parser.cc
File runtime/vm/parser.cc (right):

https://codereview.chromium.org/362153002/diff/240001/runtime/vm/parser.cc#ne...
runtime/vm/parser.cc:2907: ReportError("async modifier requires dart:async to be
imported");
On 2014/07/29 21:10:33, Ivan Posva wrote:
> dart:async needs to be imported without prefix, correct?

Yes, I will clarify the error when I reland this.

Powered by Google App Engine
This is Rietveld 408576698