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

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

Issue 2875063003: Fix bugs supporting configuring DDC runtime settings before the application starts. (Closed)
Patch Set: Created 3 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) 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 // We need to set these properties while the sdk is only partially initialized
7 bool _ignoreWhitelistedErrors = true; 7 // so we cannot use regular Dart fields.
8 bool _failForWeakModeIsChecks = true; 8 bool get _trapRuntimeErrors => JS('bool', 'dart.__trapRuntimeErrors');
vsm 2017/05/11 21:45:56 Can you add a comment as to where these are now ac
9 bool get _ignoreWhitelistedErrors =>
10 JS('bool', 'dart.__ignoreWhitelistedErrors');
11 bool get _failForWeakModeIsChecks =>
12 JS('bool', 'dart.__failForWeakModeIsChecks');
9 13
10 // Override, e.g., for testing 14 // Override, e.g., for testing
11 void trapRuntimeErrors(bool flag) { 15 void trapRuntimeErrors(bool flag) {
12 _trapRuntimeErrors = flag; 16 JS('', 'dart.__trapRuntimeErrors = #', flag);
13 } 17 }
14 18
15 void ignoreWhitelistedErrors(bool flag) { 19 void ignoreWhitelistedErrors(bool flag) {
16 _ignoreWhitelistedErrors = flag; 20 JS('', 'dart.__ignoreWhitelistedErrors = #', flag);
17 } 21 }
18 22
19 /// Throw an exception on `is` checks that would return an unsound answer in 23 /// Throw an exception on `is` checks that would return an unsound answer in
20 /// non-strong mode Dart. 24 /// non-strong mode Dart.
21 /// 25 ///
22 /// For example `x is List<int>` where `x = <Object>['hello']`. 26 /// For example `x is List<int>` where `x = <Object>['hello']`.
23 /// 27 ///
24 /// These checks behave correctly in strong mode (they return false), however, 28 /// These checks behave correctly in strong mode (they return false), however,
25 /// they will produce a different answer if run on a platform without strong 29 /// they will produce a different answer if run on a platform without strong
26 /// mode. As a debugging feature, these checks can be configured to throw, to 30 /// mode. As a debugging feature, these checks can be configured to throw, to
27 /// avoid seeing different behavior between modes. 31 /// avoid seeing different behavior between modes.
28 /// 32 ///
29 /// (There are many other ways that different `is` behavior can be observed, 33 /// (There are many other ways that different `is` behavior can be observed,
30 /// however, even with this flag. The most obvious is due to lack of reified 34 /// however, even with this flag. The most obvious is due to lack of reified
31 /// generic type parameters. This affects generic functions and methods, as 35 /// generic type parameters. This affects generic functions and methods, as
32 /// well as generic types when the type parameter was inferred. Setting this 36 /// well as generic types when the type parameter was inferred. Setting this
33 /// flag to `true` will not catch these differences in behavior..) 37 /// flag to `true` will not catch these differences in behavior..)
34 void failForWeakModeIsChecks(bool flag) { 38 void failForWeakModeIsChecks(bool flag) {
35 _failForWeakModeIsChecks = flag; 39 JS('', 'dart.__failForWeakModeIsChecks = #', flag);
36 } 40 }
37 41
38 throwCastError(object, actual, type) => JS( 42 throwCastError(object, actual, type) => JS(
39 '', 43 '',
40 '''(() => { 44 '''(() => {
41 var found = $typeName($actual); 45 var found = $typeName($actual);
42 var expected = $typeName($type); 46 var expected = $typeName($type);
43 if ($_trapRuntimeErrors) debugger; 47 if ($_trapRuntimeErrors) debugger;
44 $throw_(new $CastErrorImplementation($object, found, expected)); 48 $throw_(new $CastErrorImplementation($object, found, expected));
45 })()'''); 49 })()''');
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 })()'''); 109 })()''');
106 110
107 throwNoSuchMethodError( 111 throwNoSuchMethodError(
108 receiver, memberName, positionalArguments, namedArguments) => 112 receiver, memberName, positionalArguments, namedArguments) =>
109 JS( 113 JS(
110 '', 114 '',
111 '''(() => { 115 '''(() => {
112 if ($_trapRuntimeErrors) debugger; 116 if ($_trapRuntimeErrors) debugger;
113 $throw_(new $NoSuchMethodError($receiver, $memberName, $positionalArguments, $ namedArguments)); 117 $throw_(new $NoSuchMethodError($receiver, $memberName, $positionalArguments, $ namedArguments));
114 })()'''); 118 })()''');
OLDNEW
« no previous file with comments | « pkg/dev_compiler/lib/sdk/ddc_sdk.sum ('k') | pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/profile.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698