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

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: Adress Review 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
« no previous file with comments | « no previous file | tests/language/asyncstar_throw_in_catch_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 GET_TYPE_FROM_NAME, 10 GET_TYPE_FROM_NAME,
(...skipping 3706 matching lines...) Expand 10 before | Expand all | Expand 10 after
3717 bool stopRunning = false; 3717 bool stopRunning = false;
3718 bool isAdding = false; 3718 bool isAdding = false;
3719 bool get isPaused => controller.isPaused; 3719 bool get isPaused => controller.isPaused;
3720 add(event) => controller.add(event); 3720 add(event) => controller.add(event);
3721 addStream(Stream stream) { 3721 addStream(Stream stream) {
3722 return controller.addStream(stream, cancelOnError: false); 3722 return controller.addStream(stream, cancelOnError: false);
3723 } 3723 }
3724 addError(error, stackTrace) => controller.addError(error, stackTrace); 3724 addError(error, stackTrace) => controller.addError(error, stackTrace);
3725 close() => controller.close(); 3725 close() => controller.close();
3726 3726
3727 AsyncStarStreamController(helperCallback) { 3727 AsyncStarStreamController(body) {
3728 controller = new StreamController( 3728 controller = new StreamController(
3729 onListen: () { 3729 onListen: () {
3730 scheduleMicrotask(() { 3730 scheduleMicrotask(() {
3731 JS('', '#(#, null)', helperCallback, async_error_codes.SUCCESS); 3731 Function wrapped = _wrapJsFunctionForAsync(body,
3732 async_error_codes.SUCCESS);
3733 wrapped(null);
3732 }); 3734 });
3733 }, 3735 },
3734 onResume: () { 3736 onResume: () {
3735 if (!isAdding) { 3737 if (!isAdding) {
3736 asyncStarHelper(null, helperCallback, this); 3738 asyncStarHelper(null, body, this);
3737 } 3739 }
3738 }, onCancel: () { 3740 }, onCancel: () {
3739 stopRunning = true; 3741 stopRunning = true;
3740 }); 3742 });
3741 } 3743 }
3742 } 3744 }
3743 3745
3744 makeAsyncStarController(helperCallback) { 3746 makeAsyncStarController(body) {
3745 return new AsyncStarStreamController(helperCallback); 3747 return new AsyncStarStreamController(body);
3746 } 3748 }
3747 3749
3748 class IterationMarker { 3750 class IterationMarker {
3749 static const YIELD_SINGLE = 0; 3751 static const YIELD_SINGLE = 0;
3750 static const YIELD_STAR = 1; 3752 static const YIELD_STAR = 1;
3751 static const ITERATION_ENDED = 2; 3753 static const ITERATION_ENDED = 2;
3752 static const UNCAUGHT_ERROR = 3; 3754 static const UNCAUGHT_ERROR = 3;
3753 3755
3754 final value; 3756 final value;
3755 final int state; 3757 final int state;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
3843 // This is a function that will return a helper function that does the 3845 // This is a function that will return a helper function that does the
3844 // iteration of the sync*. 3846 // iteration of the sync*.
3845 // 3847 //
3846 // Each invocation should give a body with fresh state. 3848 // Each invocation should give a body with fresh state.
3847 final dynamic /* js function */ _outerHelper; 3849 final dynamic /* js function */ _outerHelper;
3848 3850
3849 SyncStarIterable(this._outerHelper); 3851 SyncStarIterable(this._outerHelper);
3850 3852
3851 Iterator get iterator => new SyncStarIterator(JS('', '#()', _outerHelper)); 3853 Iterator get iterator => new SyncStarIterator(JS('', '#()', _outerHelper));
3852 } 3854 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/asyncstar_throw_in_catch_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698