You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Stream<int> foo(Stream stream) async* {
await for (List data in stream) {
print('Will iterate ${data} ${data.runtimeType}');
for (var i in data) {
print('got $i');
}
}
}
main() async {
var c;
c = new StreamController(onListen: () async {
c.add([1,2,3]);
});
// foo(p()).listen((v) {});
foo(c.stream).listen((v) {});
}
On the VM prints:
Will iterate [1, 2, 3] List
got 1
got 2
got 3
But on dart2js it prints:
Will iterate [1, 2, 3] JSArray
The js for the inner for loop (before async-translation) is
for (t2 = J.get$iterator$a(data); t2.moveNext$0(), false;) {
i = t2.get$current();
line = "got " + H.S(i);
H.printString(line);
}
I am not sure where the , false comes from. It seems to be an inferrence problem. If the commented line is inserted the problem disappears.
The text was updated successfully, but these errors were encountered:
The program:
import 'dart:async';
p() async* {
yield [1, 2, 3];
}
Stream<int> foo(Stream stream) async* {
await for (List data in stream) {
print('Will iterate ${data} ${data.runtimeType}');
for (var i in data) {
print('got $i');
}
}
}
main() async {
var c;
c = new StreamController(onListen: () async {
c.add([1,2,3]);
});
// foo(p()).listen((v) {});
foo(c.stream).listen((v) {});
}
On the VM prints:
Will iterate [1, 2, 3] List
got 1
got 2
got 3
But on dart2js it prints:
Will iterate [1, 2, 3] JSArray
The js for the inner for loop (before async-translation) is
for (t2 = J.get$iterator$a(data); t2.moveNext$0(), false;) {
i = t2.get$current();
line = "got " + H.S(i);
H.printString(line);
}
I am not sure where the
, false
comes from. It seems to be an inferrence problem. If the commented line is inserted the problem disappears.The text was updated successfully, but these errors were encountered: