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

Side by Side Diff: tool/input_sdk/lib/async/async_error.dart

Issue 1953823005: Only use white list on indefinite checks (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of dart.async; 5 part of dart.async;
6 6
7 _invokeErrorHandler(Function errorHandler, 7 _invokeErrorHandler(Function errorHandler,
8 Object error, StackTrace stackTrace) { 8 Object error, StackTrace stackTrace) {
9 if (errorHandler is ZoneBinaryCallback) { 9 if (errorHandler is ZoneBinaryCallback) {
10 return errorHandler(error, stackTrace); 10 return errorHandler(error, stackTrace);
11 } else { 11 } else {
12 ZoneUnaryCallback unaryErrorHandler = errorHandler; 12 ZoneUnaryCallback unaryErrorHandler = errorHandler;
13 return unaryErrorHandler(error); 13 return unaryErrorHandler(error);
14 } 14 }
15 } 15 }
16 16
17 Function _registerErrorHandler/*<R>*/(Function errorHandler, Zone zone) { 17 Function _registerErrorHandler/*<R>*/(Function errorHandler, Zone zone) {
18 if (errorHandler is ZoneBinaryCallback) { 18 if (errorHandler is ZoneBinaryCallback) {
19 return zone.registerBinaryCallback/*<R, dynamic, StackTrace>*/( 19 // TODO(leafp): These are commented out, because the async libraries
20 errorHandler as dynamic/*=ZoneBinaryCallback<R, dynamic, StackTrace>*/); 20 // pass a (...) -> void into this function which fails whenever R
21 // is something interesting. This needs to be sorted out in the main
22 // SDK as to what the intent is here: if this is really supposed to
23 // return an R, then the function that gets passed in is wrong. If not,
24 // then this code doesn't need to track the return type at all.
25 // return zone.registerBinaryCallback/*<R, dynamic, StackTrace>*/(
26 // errorHandler as dynamic/*=ZoneBinaryCallback<R, dynamic, StackTrac e>*/);
27 return zone.registerBinaryCallback/*<dynamic, dynamic, StackTrace>*/(
28 errorHandler as dynamic/*=ZoneBinaryCallback<dynamic, dynamic, StackTrac e>*/);
21 } else { 29 } else {
22 return zone.registerUnaryCallback/*<R, dynamic>*/( 30 // return zone.registerUnaryCallback/*<R, dynamic>*/(
23 errorHandler as dynamic/*=ZoneUnaryCallback<R, dynamic>*/); 31 // errorHandler as dynamic/*=ZoneUnaryCallback<R, dynamic>*/);
32 return zone.registerUnaryCallback/*<dynamic, dynamic>*/(
33 errorHandler as dynamic/*=ZoneUnaryCallback<dynamic, dynamic>*/);
24 } 34 }
25 } 35 }
26 36
27 class _UncaughtAsyncError extends AsyncError { 37 class _UncaughtAsyncError extends AsyncError {
28 _UncaughtAsyncError(error, StackTrace stackTrace) 38 _UncaughtAsyncError(error, StackTrace stackTrace)
29 : super(error, _getBestStackTrace(error, stackTrace)); 39 : super(error, _getBestStackTrace(error, stackTrace));
30 40
31 static StackTrace _getBestStackTrace(error, StackTrace stackTrace) { 41 static StackTrace _getBestStackTrace(error, StackTrace stackTrace) {
32 if (stackTrace != null) return stackTrace; 42 if (stackTrace != null) return stackTrace;
33 if (error is Error) { 43 if (error is Error) {
34 return error.stackTrace; 44 return error.stackTrace;
35 } 45 }
36 return null; 46 return null;
37 } 47 }
38 48
39 String toString() { 49 String toString() {
40 String result = "Uncaught Error: ${error}"; 50 String result = "Uncaught Error: ${error}";
41 51
42 if (stackTrace != null) { 52 if (stackTrace != null) {
43 result += "\nStack Trace:\n$stackTrace"; 53 result += "\nStack Trace:\n$stackTrace";
44 } 54 }
45 return result; 55 return result;
46 } 56 }
47 } 57 }
OLDNEW
« no previous file with comments | « test/codegen/lib/typed_data/typed_data_list_test.dart ('k') | tool/input_sdk/private/ddc_runtime/operations.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698