| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import "dart:_internal" hide Symbol; | 5 import "dart:_internal" hide Symbol; |
| 6 | 6 |
| 7 // Equivalent of calling FATAL from C++ code. | 7 // Equivalent of calling FATAL from C++ code. |
| 8 _fatal(msg) native "DartAsync_fatal"; | 8 _fatal(msg) native "DartAsync_fatal"; |
| 9 | 9 |
| 10 // We need to pass the value as first argument and leave the second and third | 10 // We need to pass the value as first argument and leave the second and third |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // Called as part of the 'await for (...)' construct. Registers the | 66 // Called as part of the 'await for (...)' construct. Registers the |
| 67 // awaiter on the stream. | 67 // awaiter on the stream. |
| 68 void _asyncStarListenHelper(var object, var awaiter) { | 68 void _asyncStarListenHelper(var object, var awaiter) { |
| 69 if (object is! _StreamImpl) { | 69 if (object is! _StreamImpl) { |
| 70 return; | 70 return; |
| 71 } | 71 } |
| 72 // `object` is a `_StreamImpl`. | 72 // `object` is a `_StreamImpl`. |
| 73 object._awaiter = awaiter; | 73 object._awaiter = awaiter; |
| 74 } | 74 } |
| 75 | 75 |
| 76 void _asyncStarMoveNextHelper(var stream) { |
| 77 if (stream is! _StreamImpl) { |
| 78 return; |
| 79 } |
| 80 // stream is a _StreamImpl. |
| 81 if (stream._generator == null) { |
| 82 // No generator registered, this isn't an async* Stream. |
| 83 return; |
| 84 } |
| 85 _moveNextDebuggerStepCheck(stream._generator); |
| 86 } |
| 87 |
| 76 // _AsyncStarStreamController is used by the compiler to implement | 88 // _AsyncStarStreamController is used by the compiler to implement |
| 77 // async* generator functions. | 89 // async* generator functions. |
| 78 class _AsyncStarStreamController { | 90 class _AsyncStarStreamController { |
| 79 StreamController controller; | 91 StreamController controller; |
| 80 Function asyncStarBody; | 92 Function asyncStarBody; |
| 81 bool isAdding = false; | 93 bool isAdding = false; |
| 82 bool onListenReceived = false; | 94 bool onListenReceived = false; |
| 83 bool isScheduled = false; | 95 bool isScheduled = false; |
| 84 bool isSuspendedAtYield = false; | 96 bool isSuspendedAtYield = false; |
| 85 Completer cancellationCompleter = null; | 97 Completer cancellationCompleter = null; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 /// The closure implementing the async[*]-body that is `await`ing this future. | 237 /// The closure implementing the async[*]-body that is `await`ing this future. |
| 226 Function _awaiter; | 238 Function _awaiter; |
| 227 | 239 |
| 228 /// The closure implementing the async-generator body that is creating events | 240 /// The closure implementing the async-generator body that is creating events |
| 229 /// for this stream. | 241 /// for this stream. |
| 230 Function _generator; | 242 Function _generator; |
| 231 } | 243 } |
| 232 | 244 |
| 233 /// Returns a [StackTrace] object containing the synchronous prefix for this | 245 /// Returns a [StackTrace] object containing the synchronous prefix for this |
| 234 /// asynchronous method. | 246 /// asynchronous method. |
| 235 Object _asyncStackTraceHelper() native "StackTrace_asyncStackTraceHelper"; | 247 Object _asyncStackTraceHelper(Function async_op) |
| 248 native "StackTrace_asyncStackTraceHelper"; |
| 236 | 249 |
| 237 void _clearAsyncThreadStackTrace() | 250 void _clearAsyncThreadStackTrace() |
| 238 native "StackTrace_clearAsyncThreadStackTrace"; | 251 native "StackTrace_clearAsyncThreadStackTrace"; |
| 239 | 252 |
| 240 void _setAsyncThreadStackTrace(StackTrace stackTrace) | 253 void _setAsyncThreadStackTrace(StackTrace stackTrace) |
| 241 native "StackTrace_setAsyncThreadStackTrace"; | 254 native "StackTrace_setAsyncThreadStackTrace"; |
| 255 |
| 256 void _moveNextDebuggerStepCheck(Function async_op) |
| 257 native "AsyncStarMoveNext_debuggerStepCheck"; |
| OLD | NEW |