Await and function parameters

76 views
Skip to first unread message

Alexey Knyazev

unread,
Oct 2, 2015, 11:08:09 AM10/2/15
to Dart Misc
Why are function parameters treated differently when it was called with await instead of using '.then'? For example, this code
import 'dart:async';

main
() async {
 
Future foo(int a1, int a2) {
   
print("from foo: $a1 $a2");
   
return new Future.value();
 
}

 
int a = 0;

  await foo
(a++, a++);
 
print("after await foo: $a");

  a
= 0;
  foo
(a++, a++).then((_) {
   
print("after foo.then: $a");
 
});
}

prints
from foo: 0 0
after await foo
: 1
from foo: 0 1
after foo
.then: 2

Matthias Hausner

unread,
Oct 2, 2015, 11:51:00 AM10/2/15
to General Dart Discussion
This looks like a bug to me. Can you please report it at dartbug.com?

Thank you,

Matthias


--
For other discussions, see https://groups.google.com/a/dartlang.org/
 
For HOWTO questions, visit http://stackoverflow.com/tags/dart
 
To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.

Günter Zöchbauer

unread,
Oct 2, 2015, 12:42:57 PM10/2/15
to Dart Misc
Works fine in JS https://dartpad.dartlang.org/040571aae27081d171ba but can reproduce on local VM 
Dart VM version: 1.13.0-edge.33b037125fbf5e8319a99fd5e5700441c921efde (Mon Sep 14 18:13:24 2015) on "linux_x64"

Matthias Hausner

unread,
Oct 2, 2015, 7:03:46 PM10/2/15
to General Dart Discussion
Bug filed or not, here's the fix:




Alexey Knyazev

unread,
Oct 2, 2015, 7:53:35 PM10/2/15
to Dart Misc
Thanks, bug was here
https://github.com/dart-lang/sdk/issues/24488

суббота, 3 октября 2015 г., 3:03:46 UTC+4 пользователь Matthias написал:
Reply all
Reply to author
Forward
0 new messages