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

Side by Side Diff: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/errors.dart

Issue 2739863003: Add option to suppress type-check whitelisting (Closed)
Patch Set: Created 3 years, 9 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) 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 part of dart._runtime; 4 part of dart._runtime;
5 5
6 bool _trapRuntimeErrors = true; 6 bool _trapRuntimeErrors = true;
7 bool _ignoreWhitelistedErrors = true;
7 8
8 // Override, e.g., for testing 9 // Override, e.g., for testing
9 void trapRuntimeErrors(bool flag) { 10 void trapRuntimeErrors(bool flag) {
10 _trapRuntimeErrors = flag; 11 _trapRuntimeErrors = flag;
11 } 12 }
12 13
14 void ignoreWhitelistedErrors(bool flag) {
15 _ignoreWhitelistedErrors = flag;
16 }
17
13 throwCastError(object, actual, type) => JS('', '''(() => { 18 throwCastError(object, actual, type) => JS('', '''(() => {
14 var found = $typeName($actual); 19 var found = $typeName($actual);
15 var expected = $typeName($type); 20 var expected = $typeName($type);
16 if ($_trapRuntimeErrors) debugger; 21 if ($_trapRuntimeErrors) debugger;
17 $throw_(new $CastErrorImplementation($object, found, expected)); 22 $throw_(new $CastErrorImplementation($object, found, expected));
18 })()'''); 23 })()''');
19 24
20 throwTypeError(object, actual, type) => JS('', '''(() => { 25 throwTypeError(object, actual, type) => JS('', '''(() => {
21 var found = $typeName($actual); 26 var found = $typeName($actual);
22 var expected = $typeName($type); 27 var expected = $typeName($type);
(...skipping 29 matching lines...) Expand all
52 })()'''); 57 })()''');
53 58
54 throwNullValueError() => JS('', '''(() => { 59 throwNullValueError() => JS('', '''(() => {
55 // TODO(vsm): Per spec, we should throw an NSM here. Technically, we ought 60 // TODO(vsm): Per spec, we should throw an NSM here. Technically, we ought
56 // to thread through method info, but that uglifies the code and can't 61 // to thread through method info, but that uglifies the code and can't
57 // actually be queried ... it only affects how the error is printed. 62 // actually be queried ... it only affects how the error is printed.
58 if ($_trapRuntimeErrors) debugger; 63 if ($_trapRuntimeErrors) debugger;
59 $throw_(new $NoSuchMethodError(null, 64 $throw_(new $NoSuchMethodError(null,
60 new $Symbol('<Unexpected Null Value>'), null, null, null)); 65 new $Symbol('<Unexpected Null Value>'), null, null, null));
61 })()'''); 66 })()''');
OLDNEW
« no previous file with comments | « pkg/dev_compiler/test/browser/language_tests.js ('k') | pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698