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

Side by Side Diff: sdk/lib/_internal/compiler/js_lib/js_helper.dart

Issue 947433002: Asyncstar - exception thrown before yield or await would not get caught (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library _js_helper; 5 library _js_helper;
6 6
7 import 'dart:_async_await_error_codes' as async_error_codes; 7 import 'dart:_async_await_error_codes' as async_error_codes;
8 8
9 import 'dart:_js_embedded_names' show 9 import 'dart:_js_embedded_names' show
10 JsGetName, 10 JsGetName,
(...skipping 3711 matching lines...) Expand 10 before | Expand all | Expand 10 after
3722 bool stopRunning = false; 3722 bool stopRunning = false;
3723 bool isAdding = false; 3723 bool isAdding = false;
3724 bool get isPaused => controller.isPaused; 3724 bool get isPaused => controller.isPaused;
3725 add(event) => controller.add(event); 3725 add(event) => controller.add(event);
3726 addStream(Stream stream) { 3726 addStream(Stream stream) {
3727 return controller.addStream(stream, cancelOnError: false); 3727 return controller.addStream(stream, cancelOnError: false);
3728 } 3728 }
3729 addError(error, stackTrace) => controller.addError(error, stackTrace); 3729 addError(error, stackTrace) => controller.addError(error, stackTrace);
3730 close() => controller.close(); 3730 close() => controller.close();
3731 3731
3732 AsyncStarStreamController(helperCallback) { 3732 AsyncStarStreamController(body) {
3733 controller = new StreamController( 3733 controller = new StreamController(
3734 onListen: () { 3734 onListen: () {
3735 scheduleMicrotask(() { 3735 scheduleMicrotask(() {
3736 JS('', '#(#, null)', helperCallback, async_error_codes.SUCCESS); 3736 _wrapJsFunctionForAsync(body,
floitsch 2015/02/20 12:16:08 nit: the "(null)" drowns. maybe: Function wrapped
sigurdm 2015/02/23 12:33:49 Done.
3737 async_error_codes.SUCCESS)(null);
3737 }); 3738 });
3738 }, 3739 },
3739 onResume: () { 3740 onResume: () {
3740 if (!isAdding) { 3741 if (!isAdding) {
3741 asyncStarHelper(null, helperCallback, this); 3742 asyncStarHelper(null, body, this);
3742 } 3743 }
3743 }, onCancel: () { 3744 }, onCancel: () {
3744 stopRunning = true; 3745 stopRunning = true;
3745 }); 3746 });
3746 } 3747 }
3747 } 3748 }
3748 3749
3749 makeAsyncStarController(helperCallback) { 3750 makeAsyncStarController(body) {
3750 return new AsyncStarStreamController(helperCallback); 3751 return new AsyncStarStreamController(body);
3751 } 3752 }
3752 3753
3753 class IterationMarker { 3754 class IterationMarker {
3754 static const YIELD_SINGLE = 0; 3755 static const YIELD_SINGLE = 0;
3755 static const YIELD_STAR = 1; 3756 static const YIELD_STAR = 1;
3756 static const ITERATION_ENDED = 2; 3757 static const ITERATION_ENDED = 2;
3757 static const UNCAUGHT_ERROR = 3; 3758 static const UNCAUGHT_ERROR = 3;
3758 3759
3759 final value; 3760 final value;
3760 final int state; 3761 final int state;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
3848 // This is a function that will return a helper function that does the 3849 // This is a function that will return a helper function that does the
3849 // iteration of the sync*. 3850 // iteration of the sync*.
3850 // 3851 //
3851 // Each invocation should give a body with fresh state. 3852 // Each invocation should give a body with fresh state.
3852 final dynamic /* js function */ _outerHelper; 3853 final dynamic /* js function */ _outerHelper;
3853 3854
3854 SyncStarIterable(this._outerHelper); 3855 SyncStarIterable(this._outerHelper);
3855 3856
3856 Iterator get iterator => new SyncStarIterator(JS('', '#()', _outerHelper)); 3857 Iterator get iterator => new SyncStarIterator(JS('', '#()', _outerHelper));
3857 } 3858 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/asyncstar_throw_in_catch_test.dart » ('j') | tests/language/asyncstar_throw_in_catch_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698