Add :controller_stream and call _asyncStarListenHelper

This changes how we step out of async* functions slightly to match how
Dart1 behaves.

Bug: #29158

Change-Id: I8ee2df5eee8167fd1907a6e9f30c9dc7ab6939b1
Reviewed-on: https://dart-review.googlesource.com/63625
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
This commit is contained in:
Jens Johansen 2018-08-02 06:49:47 +00:00 committed by commit-bot@chromium.org
parent 2e98da68f9
commit ac8fdb5a58
28 changed files with 146 additions and 26 deletions

View file

@ -96,6 +96,7 @@ static method syncStarString2() → core::Iterable<core::String> /* originally s
}
static method asyncStarString() → asy::Stream<core::String> /* originally async* */ {
asy::_AsyncStarStreamController<core::String> :controller;
dynamic :controller_stream;
dynamic :async_stack_trace;
dynamic :async_op_then;
dynamic :async_op_error;
@ -134,10 +135,12 @@ static method asyncStarString() → asy::Stream<core::String> /* originally asyn
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
:controller = new asy::_AsyncStarStreamController::•<core::String>(:async_op);
return :controller.{asy::_AsyncStarStreamController::stream};
:controller_stream = :controller.{asy::_AsyncStarStreamController::stream};
return :controller_stream;
}
static method asyncStarString2() → asy::Stream<core::String> /* originally async* */ {
asy::_AsyncStarStreamController<core::String> :controller;
dynamic :controller_stream;
dynamic :async_stack_trace;
dynamic :async_op_then;
dynamic :async_op_error;
@ -167,7 +170,8 @@ static method asyncStarString2() → asy::Stream<core::String> /* originally asy
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
:controller = new asy::_AsyncStarStreamController::•<core::String>(:async_op);
return :controller.{asy::_AsyncStarStreamController::stream};
:controller_stream = :controller.{asy::_AsyncStarStreamController::stream};
return :controller_stream;
}
static method main() → dynamic /* originally async */ {
final asy::Completer<dynamic> :async_completer = asy::Completer::sync<dynamic>();

View file

@ -6,6 +6,7 @@ import "dart:core" as core;
static method test() → dynamic {
dynamic f = () → asy::Stream<dynamic> /* originally async* */ {
asy::_AsyncStarStreamController<dynamic> :controller;
dynamic :controller_stream;
dynamic :async_stack_trace;
dynamic :async_op_then;
dynamic :async_op_error;
@ -40,7 +41,8 @@ static method test() → dynamic {
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
:controller = new asy::_AsyncStarStreamController::•<dynamic>(:async_op);
return :controller.{asy::_AsyncStarStreamController::stream};
:controller_stream = :controller.{asy::_AsyncStarStreamController::stream};
return :controller_stream;
};
asy::Stream<core::num> g = f.call();
asy::Stream<core::int> h = f.call();

View file

@ -6,6 +6,7 @@ import "dart:core" as core;
static method test() → dynamic {
() → asy::Stream<core::num> f = () → asy::Stream<core::num> /* originally async* */ {
asy::_AsyncStarStreamController<core::num> :controller;
dynamic :controller_stream;
dynamic :async_stack_trace;
dynamic :async_op_then;
dynamic :async_op_error;
@ -40,7 +41,8 @@ static method test() → dynamic {
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
:controller = new asy::_AsyncStarStreamController::•<core::num>(:async_op);
return :controller.{asy::_AsyncStarStreamController::stream};
:controller_stream = :controller.{asy::_AsyncStarStreamController::stream};
return :controller_stream;
};
asy::Stream<core::num> g = f.call();
asy::Stream<core::int> h = f.call() as{TypeError} asy::Stream<core::int>;

View file

@ -18,6 +18,7 @@ static method main() → dynamic /* originally async */ {
{
dynamic f = () → asy::Stream<dynamic> /* originally async* */ {
asy::_AsyncStarStreamController<dynamic> :controller;
dynamic :controller_stream;
dynamic :async_stack_trace;
dynamic :async_op_then;
dynamic :async_op_error;
@ -47,7 +48,8 @@ static method main() → dynamic /* originally async */ {
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
:controller = new asy::_AsyncStarStreamController::•<dynamic>(:async_op);
return :controller.{asy::_AsyncStarStreamController::stream};
:controller_stream = :controller.{asy::_AsyncStarStreamController::stream};
return :controller_stream;
};
asy::Stream<dynamic> y = f.call();
asy::Stream<core::String> z = f.call();

View file

@ -18,6 +18,7 @@ static method main() → dynamic /* originally async */ {
{
() → asy::Stream<core::Null> f = () → asy::Stream<core::Null> /* originally async* */ {
asy::_AsyncStarStreamController<core::Null> :controller;
dynamic :controller_stream;
dynamic :async_stack_trace;
dynamic :async_op_then;
dynamic :async_op_error;
@ -47,7 +48,8 @@ static method main() → dynamic /* originally async */ {
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
:controller = new asy::_AsyncStarStreamController::•<core::Null>(:async_op);
return :controller.{asy::_AsyncStarStreamController::stream};
:controller_stream = :controller.{asy::_AsyncStarStreamController::stream};
return :controller_stream;
};
asy::Stream<dynamic> y = f.call();
asy::Stream<core::String> z = f.call();

View file

@ -41,6 +41,7 @@ static method f() → asy::Future<dynamic> /* originally async */ {
}
{
dynamic :stream = self::F<dynamic>();
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -63,6 +64,7 @@ static method f() → asy::Future<dynamic> /* originally async */ {
}
{
dynamic :stream = self::F<dynamic>();
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -85,6 +87,7 @@ static method f() → asy::Future<dynamic> /* originally async */ {
}
{
dynamic :stream = self::F<dynamic>();
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<core::Object> :for-iterator = new asy::_StreamIterator::•<core::Object>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -107,6 +110,7 @@ static method f() → asy::Future<dynamic> /* originally async */ {
}
{
dynamic :stream = self::F<dynamic>();
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -131,6 +135,7 @@ static method f() → asy::Future<dynamic> /* originally async */ {
}
{
dynamic :stream = self::F<dynamic>();
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -190,6 +195,7 @@ static method main() → asy::Future<dynamic> /* originally async */ {
}
{
dynamic :stream = self::MyStream::•<dynamic>();
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<core::int> :for-iterator = new asy::_StreamIterator::•<core::int>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -212,6 +218,7 @@ static method main() → asy::Future<dynamic> /* originally async */ {
}
{
dynamic :stream = self::MyStream::•<core::int>();
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try

View file

@ -41,6 +41,7 @@ static method f() → asy::Future<dynamic> /* originally async */ {
}
{
dynamic :stream = self::F<asy::Stream<dynamic>>();
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -63,6 +64,7 @@ static method f() → asy::Future<dynamic> /* originally async */ {
}
{
dynamic :stream = self::F<asy::Stream<dynamic>>();
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -85,6 +87,7 @@ static method f() → asy::Future<dynamic> /* originally async */ {
}
{
dynamic :stream = self::F<asy::Stream<core::Object>>();
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<core::Object> :for-iterator = new asy::_StreamIterator::•<core::Object>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -107,6 +110,7 @@ static method f() → asy::Future<dynamic> /* originally async */ {
}
{
dynamic :stream = self::F<asy::Stream<dynamic>>();
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -131,6 +135,7 @@ static method f() → asy::Future<dynamic> /* originally async */ {
}
{
dynamic :stream = self::F<asy::Stream<core::Object>>();
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<core::Object> :for-iterator = new asy::_StreamIterator::•<core::Object>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -190,6 +195,7 @@ static method main() → asy::Future<dynamic> /* originally async */ {
}
{
dynamic :stream = self::MyStream::•<core::int>();
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<core::int> :for-iterator = new asy::_StreamIterator::•<core::int>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -212,6 +218,7 @@ static method main() → asy::Future<dynamic> /* originally async */ {
}
{
dynamic :stream = self::MyStream::•<core::int>();
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<core::int> :for-iterator = new asy::_StreamIterator::•<core::int>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try

View file

@ -9,6 +9,7 @@ abstract class MyStream<T extends core::Object = dynamic> extends asy::Stream<se
}
static method foo() → asy::Stream<core::List<core::int>> /* originally async* */ {
asy::_AsyncStarStreamController<core::List<core::int>> :controller;
dynamic :controller_stream;
dynamic :async_stack_trace;
dynamic :async_op_then;
dynamic :async_op_error;
@ -50,7 +51,8 @@ static method foo() → asy::Stream<core::List<core::int>> /* originally async*
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
:controller = new asy::_AsyncStarStreamController::•<core::List<core::int>>(:async_op);
return :controller.{asy::_AsyncStarStreamController::stream};
:controller_stream = :controller.{asy::_AsyncStarStreamController::stream};
return :controller_stream;
}
static method bar() → core::Iterable<core::Map<core::int, core::int>> /* originally sync* */ {
dynamic :await_jump_var = 0;

View file

@ -24,6 +24,7 @@ static method test() → dynamic /* originally async */ {
}
{
dynamic :stream = o;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -50,6 +51,7 @@ static method test() → dynamic /* originally async */ {
}
{
dynamic :stream = o;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try

View file

@ -24,6 +24,7 @@ static method test() → dynamic /* originally async */ {
}
{
dynamic :stream = o as{TypeError} asy::Stream<dynamic>;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -50,6 +51,7 @@ static method test() → dynamic /* originally async */ {
}
{
dynamic :stream = o as{TypeError} asy::Stream<dynamic>;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try

View file

@ -7,6 +7,7 @@ static method foo(() → asy::Stream<core::int> values) → void {}
static method main() → void {
self::foo(() → asy::Stream<dynamic> /* originally async* */ {
asy::_AsyncStarStreamController<dynamic> :controller;
dynamic :controller_stream;
dynamic :async_stack_trace;
dynamic :async_op_then;
dynamic :async_op_error;
@ -40,6 +41,7 @@ static method main() → void {
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
:controller = new asy::_AsyncStarStreamController::•<dynamic>(:async_op);
return :controller.{asy::_AsyncStarStreamController::stream};
:controller_stream = :controller.{asy::_AsyncStarStreamController::stream};
return :controller_stream;
});
}

View file

@ -7,6 +7,7 @@ static method foo(() → asy::Stream<core::int> values) → void {}
static method main() → void {
self::foo(() → asy::Stream<core::int> /* originally async* */ {
asy::_AsyncStarStreamController<core::int> :controller;
dynamic :controller_stream;
dynamic :async_stack_trace;
dynamic :async_op_then;
dynamic :async_op_error;
@ -40,6 +41,7 @@ static method main() → void {
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
:controller = new asy::_AsyncStarStreamController::•<core::int>(:async_op);
return :controller.{asy::_AsyncStarStreamController::stream};
:controller_stream = :controller.{asy::_AsyncStarStreamController::stream};
return :controller_stream;
});
}

View file

@ -79,6 +79,7 @@ static method test() → dynamic {
}
function f5() → dynamic /* originally async* */ {
asy::_AsyncStarStreamController<dynamic> :controller;
dynamic :controller_stream;
dynamic :async_stack_trace;
dynamic :async_op_then;
dynamic :async_op_error;
@ -108,7 +109,8 @@ static method test() → dynamic {
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
:controller = new asy::_AsyncStarStreamController::•<dynamic>(:async_op);
return :controller.{asy::_AsyncStarStreamController::stream};
:controller_stream = :controller.{asy::_AsyncStarStreamController::stream};
return :controller_stream;
}
function f6() → core::num
return 42;

View file

@ -79,6 +79,7 @@ static method test() → dynamic {
}
function f5() → asy::Stream<core::int> /* originally async* */ {
asy::_AsyncStarStreamController<core::int> :controller;
dynamic :controller_stream;
dynamic :async_stack_trace;
dynamic :async_op_then;
dynamic :async_op_error;
@ -108,7 +109,8 @@ static method test() → dynamic {
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
:controller = new asy::_AsyncStarStreamController::•<core::int>(:async_op);
return :controller.{asy::_AsyncStarStreamController::stream};
:controller_stream = :controller.{asy::_AsyncStarStreamController::stream};
return :controller_stream;
}
function f6() → core::num
return 42;

View file

@ -31,6 +31,7 @@ class Bar<T extends asy::Stream<core::String> = dynamic> extends core::Object {
{
{
dynamic :stream = t;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -89,6 +90,7 @@ class Baz<T extends core::Object = dynamic, E extends asy::Stream<self::Baz::T>
{
{
dynamic :stream = t;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -149,6 +151,7 @@ static method test() → dynamic /* originally async */ {
dynamic myStream = self::MyStream::•<self::Foo>();
{
dynamic :stream = myStream;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -173,6 +176,7 @@ static method test() → dynamic /* originally async */ {
}
{
dynamic :stream = myStream;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -197,6 +201,7 @@ static method test() → dynamic /* originally async */ {
}
{
dynamic :stream = myStream;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<core::String> :for-iterator = new asy::_StreamIterator::•<core::String>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -222,6 +227,7 @@ static method test() → dynamic /* originally async */ {
dynamic z;
{
dynamic :stream = myStream;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -248,6 +254,7 @@ static method test() → dynamic /* originally async */ {
asy::Stream<dynamic> stream = myStream;
{
dynamic :stream = stream;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<self::Foo> :for-iterator = new asy::_StreamIterator::•<self::Foo>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -273,6 +280,7 @@ static method test() → dynamic /* originally async */ {
dynamic stream2 = myStream;
{
dynamic :stream = stream2;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<self::Foo> :for-iterator = new asy::_StreamIterator::•<self::Foo>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -298,6 +306,7 @@ static method test() → dynamic /* originally async */ {
dynamic map = <core::String, self::Foo>{};
{
dynamic :stream = map;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try

View file

@ -31,6 +31,7 @@ class Bar<T extends asy::Stream<core::String> = asy::Stream<core::String>> exten
{
{
dynamic :stream = t;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<core::String> :for-iterator = new asy::_StreamIterator::•<core::String>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -92,6 +93,7 @@ class Baz<T extends core::Object = dynamic, E extends asy::Stream<self::Baz::T>
{
{
dynamic :stream = t;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<self::Baz::T> :for-iterator = new asy::_StreamIterator::•<self::Baz::T>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -155,6 +157,7 @@ static method test() → dynamic /* originally async */ {
self::MyStream<self::Foo> myStream = self::MyStream::•<self::Foo>();
{
dynamic :stream = myStream;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<self::Foo> :for-iterator = new asy::_StreamIterator::•<self::Foo>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -182,6 +185,7 @@ Try changing the type of the left hand side, or casting the right hand side to '
}
{
dynamic :stream = myStream;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -206,6 +210,7 @@ Try changing the type of the left hand side, or casting the right hand side to '
}
{
dynamic :stream = myStream;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<self::Foo> :for-iterator = new asy::_StreamIterator::•<self::Foo>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -235,6 +240,7 @@ Try changing the type of the variable.
dynamic z;
{
dynamic :stream = myStream;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<self::Foo> :for-iterator = new asy::_StreamIterator::•<self::Foo>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -261,6 +267,7 @@ Try changing the type of the variable.
asy::Stream<dynamic> stream = myStream;
{
dynamic :stream = stream;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -287,6 +294,7 @@ Try changing the type of the variable.
dynamic stream2 = myStream;
{
dynamic :stream = stream2 as{TypeError} asy::Stream<dynamic>;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -315,6 +323,7 @@ Try changing the type of the variable.
dynamic :stream = let<BottomType> _ = null in let final dynamic #t37 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:66:74: Error: The type 'dart.core::Map<dart.core::String, test::Foo>' used in the 'for' loop must implement 'dart.async::Stream<dynamic>'.
await for (var /*@type=dynamic*/ x in /*error:FOR_IN_OF_INVALID_TYPE*/ map) {
^" in let final core::Map<core::String, self::Foo> #t38 = map in null;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try

View file

@ -65,6 +65,7 @@ static method main() → dynamic {
}
function e() → asy::Stream<(core::int) → core::int> /* originally async* */ {
asy::_AsyncStarStreamController<(core::int) → core::int> :controller;
dynamic :controller_stream;
dynamic :async_stack_trace;
dynamic :async_op_then;
dynamic :async_op_error;
@ -94,10 +95,12 @@ static method main() → dynamic {
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
:controller = new asy::_AsyncStarStreamController::•<(core::int) → core::int>(:async_op);
return :controller.{asy::_AsyncStarStreamController::stream};
:controller_stream = :controller.{asy::_AsyncStarStreamController::stream};
return :controller_stream;
}
function f() → asy::Stream<(core::int) → core::int> /* originally async* */ {
asy::_AsyncStarStreamController<(core::int) → core::int> :controller;
dynamic :controller_stream;
dynamic :async_stack_trace;
dynamic :async_op_then;
dynamic :async_op_error;
@ -127,6 +130,7 @@ static method main() → dynamic {
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
:controller = new asy::_AsyncStarStreamController::•<(core::int) → core::int>(:async_op);
return :controller.{asy::_AsyncStarStreamController::stream};
:controller_stream = :controller.{asy::_AsyncStarStreamController::stream};
return :controller_stream;
}
}

View file

@ -68,6 +68,7 @@ Try changing the type of the left hand side, or casting the right hand side to '
}
function e() → asy::Stream<(core::int) → core::int> /* originally async* */ {
asy::_AsyncStarStreamController<(core::int) → core::int> :controller;
dynamic :controller_stream;
dynamic :async_stack_trace;
dynamic :async_op_then;
dynamic :async_op_error;
@ -97,10 +98,12 @@ Try changing the type of the left hand side, or casting the right hand side to '
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
:controller = new asy::_AsyncStarStreamController::•<(core::int) → core::int>(:async_op);
return :controller.{asy::_AsyncStarStreamController::stream};
:controller_stream = :controller.{asy::_AsyncStarStreamController::stream};
return :controller_stream;
}
function f() → asy::Stream<(core::int) → core::int> /* originally async* */ {
asy::_AsyncStarStreamController<(core::int) → core::int> :controller;
dynamic :controller_stream;
dynamic :async_stack_trace;
dynamic :async_op_then;
dynamic :async_op_error;
@ -130,6 +133,7 @@ Try changing the type of the left hand side, or casting the right hand side to '
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
:controller = new asy::_AsyncStarStreamController::•<(core::int) → core::int>(:async_op);
return :controller.{asy::_AsyncStarStreamController::stream};
:controller_stream = :controller.{asy::_AsyncStarStreamController::stream};
return :controller_stream;
}
}

View file

@ -64,6 +64,7 @@ static method d() → core::Iterable<(core::int) → core::int> /* originally sy
}
static method e() → asy::Stream<(core::int) → core::int> /* originally async* */ {
asy::_AsyncStarStreamController<(core::int) → core::int> :controller;
dynamic :controller_stream;
dynamic :async_stack_trace;
dynamic :async_op_then;
dynamic :async_op_error;
@ -93,10 +94,12 @@ static method e() → asy::Stream<(core::int) → core::int> /* originally async
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
:controller = new asy::_AsyncStarStreamController::•<(core::int) → core::int>(:async_op);
return :controller.{asy::_AsyncStarStreamController::stream};
:controller_stream = :controller.{asy::_AsyncStarStreamController::stream};
return :controller_stream;
}
static method f() → asy::Stream<(core::int) → core::int> /* originally async* */ {
asy::_AsyncStarStreamController<(core::int) → core::int> :controller;
dynamic :controller_stream;
dynamic :async_stack_trace;
dynamic :async_op_then;
dynamic :async_op_error;
@ -126,6 +129,7 @@ static method f() → asy::Stream<(core::int) → core::int> /* originally async
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
:controller = new asy::_AsyncStarStreamController::•<(core::int) → core::int>(:async_op);
return :controller.{asy::_AsyncStarStreamController::stream};
:controller_stream = :controller.{asy::_AsyncStarStreamController::stream};
return :controller_stream;
}
static method main() → dynamic {}

View file

@ -67,6 +67,7 @@ static method d() → core::Iterable<(core::int) → core::int> /* originally sy
}
static method e() → asy::Stream<(core::int) → core::int> /* originally async* */ {
asy::_AsyncStarStreamController<(core::int) → core::int> :controller;
dynamic :controller_stream;
dynamic :async_stack_trace;
dynamic :async_op_then;
dynamic :async_op_error;
@ -96,10 +97,12 @@ static method e() → asy::Stream<(core::int) → core::int> /* originally async
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
:controller = new asy::_AsyncStarStreamController::•<(core::int) → core::int>(:async_op);
return :controller.{asy::_AsyncStarStreamController::stream};
:controller_stream = :controller.{asy::_AsyncStarStreamController::stream};
return :controller_stream;
}
static method f() → asy::Stream<(core::int) → core::int> /* originally async* */ {
asy::_AsyncStarStreamController<(core::int) → core::int> :controller;
dynamic :controller_stream;
dynamic :async_stack_trace;
dynamic :async_op_then;
dynamic :async_op_error;
@ -129,6 +132,7 @@ static method f() → asy::Stream<(core::int) → core::int> /* originally async
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
:controller = new asy::_AsyncStarStreamController::•<(core::int) → core::int>(:async_op);
return :controller.{asy::_AsyncStarStreamController::stream};
:controller_stream = :controller.{asy::_AsyncStarStreamController::stream};
return :controller_stream;
}
static method main() → dynamic {}

View file

@ -24,6 +24,7 @@ static method test() → dynamic /* originally async */ {
}
{
dynamic :stream = s;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<core::int> :for-iterator = new asy::_StreamIterator::•<core::int>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -50,6 +51,7 @@ static method test() → dynamic /* originally async */ {
}
{
dynamic :stream = s;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try

View file

@ -29,6 +29,7 @@ static method test() → dynamic /* originally async */ {
dynamic :stream = let<BottomType> _ = null in let final dynamic #t4 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:11:59: Error: The type 'dart.core::String' used in the 'for' loop must implement 'dart.async::Stream<dynamic>'.
await for (int x in /*@error=ForInLoopTypeNotIterable*/ s) {}
^" in let final core::String #t5 = s in null;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -61,6 +62,7 @@ static method test() → dynamic /* originally async */ {
dynamic :stream = let<BottomType> _ = null in let final dynamic #t13 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart:14:55: Error: The type 'dart.core::String' used in the 'for' loop must implement 'dart.async::Stream<dynamic>'.
await for (y in /*@error=ForInLoopTypeNotIterable*/ s) {}
^" in let final core::String #t14 = s in null;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try

View file

@ -41,6 +41,7 @@ static method test() → dynamic /* originally async */ {
}
{
dynamic :stream = stream;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<self::A> :for-iterator = new asy::_StreamIterator::•<self::A>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -68,6 +69,7 @@ static method test() → dynamic /* originally async */ {
}
{
dynamic :stream = stream;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<self::A> :for-iterator = new asy::_StreamIterator::•<self::A>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -95,6 +97,7 @@ static method test() → dynamic /* originally async */ {
}
{
dynamic :stream = stream;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<self::A> :for-iterator = new asy::_StreamIterator::•<self::A>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -122,6 +125,7 @@ static method test() → dynamic /* originally async */ {
}
{
dynamic :stream = self::f<dynamic>();
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try

View file

@ -41,6 +41,7 @@ static method test() → dynamic /* originally async */ {
}
{
dynamic :stream = stream;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<self::A> :for-iterator = new asy::_StreamIterator::•<self::A>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -68,6 +69,7 @@ static method test() → dynamic /* originally async */ {
}
{
dynamic :stream = stream;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<self::A> :for-iterator = new asy::_StreamIterator::•<self::A>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -98,6 +100,7 @@ Try changing the type of the variable.
}
{
dynamic :stream = stream;
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<self::A> :for-iterator = new asy::_StreamIterator::•<self::A>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try
@ -128,6 +131,7 @@ Try changing the type of the variable.
}
{
dynamic :stream = self::f<asy::Stream<self::A>>();
asy::_asyncStarListenHelper(:stream, :async_op);
asy::_StreamIterator<self::A> :for-iterator = new asy::_StreamIterator::•<self::A>(:stream);
const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product");
try

View file

@ -91,6 +91,7 @@ class CoreTypes {
Constructor _syncIterableDefaultConstructor;
Constructor _streamIteratorDefaultConstructor;
Constructor _asyncStarStreamControllerDefaultConstructor;
Procedure _asyncStarListenHelperProcedure;
Procedure _asyncStarMoveNextHelperProcedure;
Procedure _asyncStackTraceHelperProcedure;
Procedure _asyncThenWrapperHelperProcedure;
@ -149,6 +150,11 @@ class CoreTypes {
'dart:async', '_AsyncStarStreamController', 'get:stream');
}
Procedure get asyncStarListenHelper {
return _asyncStarListenHelperProcedure ??=
index.getTopLevelMember('dart:async', '_asyncStarListenHelper');
}
Procedure get asyncStarMoveNextHelper {
return _asyncStarMoveNextHelperProcedure ??=
index.getTopLevelMember('dart:async', '_asyncStarMoveNextHelper');

View file

@ -703,6 +703,7 @@ abstract class AsyncRewriterBase extends ContinuationRewriterBase {
//
// {
// :stream = <stream-expression>;
// _asyncStarListenHelper(:stream, :async_op);
// _StreamIterator<T> :for-iterator = new _StreamIterator<T>(:stream);
// const bool :product-mode =
// const bool.fromEnvironment("dart.vm.product");
@ -723,6 +724,13 @@ abstract class AsyncRewriterBase extends ContinuationRewriterBase {
var streamVariable =
new VariableDeclaration(':stream', initializer: stmt.iterable);
var asyncStarListenHelper = new ExpressionStatement(new StaticInvocation(
helper.asyncStarListenHelper,
new Arguments([
new VariableGet(streamVariable),
new VariableGet(nestedClosureVariable)
])));
var iteratorVariable = new VariableDeclaration(':for-iterator',
initializer: new ConstructorInvocation(
helper.streamIteratorConstructor,
@ -767,7 +775,8 @@ abstract class AsyncRewriterBase extends ContinuationRewriterBase {
valueVariable.initializer = new PropertyGet(
new VariableGet(iteratorVariable),
new Name('current'),
helper.streamIteratorCurrent);
helper.streamIteratorCurrent)
..fileOffset = stmt.bodyOffset;
valueVariable.initializer.parent = valueVariable;
var whileBody = new Block(<Statement>[valueVariable, stmt.body]);
@ -794,6 +803,7 @@ abstract class AsyncRewriterBase extends ContinuationRewriterBase {
var block = new Block(<Statement>[
streamVariable,
asyncStarListenHelper,
iteratorVariable,
productMode,
tryFinally
@ -905,6 +915,11 @@ class AsyncStarFunctionRewriter extends AsyncRewriterBase {
helper.asyncStarStreamControllerClass, [elementType]));
statements.add(controllerVariable);
// dynamic :controller_stream;
VariableDeclaration controllerStreamVariable =
new VariableDeclaration(":controller_stream");
statements.add(controllerStreamVariable);
setupAsyncContinuations(statements);
// :controller = new _AsyncStarStreamController<T>(:async_op);
@ -918,12 +933,16 @@ class AsyncStarFunctionRewriter extends AsyncRewriterBase {
new VariableSet(controllerVariable, buildController));
statements.add(setController);
// return :controller.stream;
// :controller_stream = :controller.stream;
var completerGet = new VariableGet(controllerVariable);
var returnStatement = new ReturnStatement(new PropertyGet(
completerGet,
new Name('stream', helper.asyncLibrary),
helper.asyncStarStreamControllerStream));
statements.add(new ExpressionStatement(new VariableSet(
controllerStreamVariable,
new PropertyGet(completerGet, new Name('stream', helper.asyncLibrary),
helper.asyncStarStreamControllerStream))));
// return :controller_stream;
var returnStatement =
new ReturnStatement(new VariableGet(controllerStreamVariable));
statements.add(returnStatement);
enclosingFunction.body = new Block(statements);
@ -1125,6 +1144,7 @@ class HelperNodes {
final Member asyncStarStreamControllerClose;
final Constructor asyncStarStreamControllerConstructor;
final Member asyncStarStreamControllerStream;
final Member asyncStarListenHelper;
final Member asyncStarMoveNextHelper;
final Procedure asyncThenWrapper;
final Procedure awaitHelper;
@ -1168,6 +1188,7 @@ class HelperNodes {
this.asyncStarStreamControllerClose,
this.asyncStarStreamControllerConstructor,
this.asyncStarStreamControllerStream,
this.asyncStarListenHelper,
this.asyncStarMoveNextHelper,
this.asyncThenWrapper,
this.awaitHelper,
@ -1212,6 +1233,7 @@ class HelperNodes {
coreTypes.asyncStarStreamControllerClose,
coreTypes.asyncStarStreamControllerDefaultConstructor,
coreTypes.asyncStarStreamControllerStream,
coreTypes.asyncStarListenHelper,
coreTypes.asyncStarMoveNextHelper,
coreTypes.asyncThenWrapperHelperProcedure,
coreTypes.awaitHelperProcedure,

View file

@ -116,7 +116,6 @@ valid_source_locations_test: RuntimeError
# These are the non-kernel specific versions so skip tests and allow errors.
[ $compiler == dartk ]
add_breakpoint_rpc_test: SkipByDesign # non-kernel specific version of add_breakpoint_rpc_kernel_test.
async_star_step_out_test: RuntimeError # Issue 29158, Async debugging
awaiter_async_stack_contents_test: RuntimeError # Issue 29158, Async debugging
evaluate_activation_in_method_class_test: RuntimeError
evaluate_activation_test/instance: RuntimeError

View file

@ -553,6 +553,13 @@ void ScopeBuilder::VisitFunctionNode() {
scope_->CaptureVariable(temp);
}
}
{
LocalVariable* temp =
scope_->LookupVariable(Symbols::ControllerStream(), true);
if (temp != NULL) {
scope_->CaptureVariable(temp);
}
}
if (FLAG_causal_async_stacks) {
LocalVariable* temp =
scope_->LookupVariable(Symbols::AsyncStackTraceVar(), true);