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

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

Issue 2996573002: fix #28988, remove throw on Dart1 incompatible is-checks for dartdevc (Closed)
Patch Set: fix changelog Created 3 years, 4 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 // We need to set these properties while the sdk is only partially initialized 6 // We need to set these properties while the sdk is only partially initialized
7 // so we cannot use regular Dart fields. 7 // so we cannot use regular Dart fields.
8 // The default values for these properties are set when the global_ final field 8 // The default values for these properties are set when the global_ final field
9 // in runtime.dart is initialized. 9 // in runtime.dart is initialized.
10 10
11 // Override, e.g., for testing 11 // Override, e.g., for testing
12 void trapRuntimeErrors(bool flag) { 12 void trapRuntimeErrors(bool flag) {
13 JS('', 'dart.__trapRuntimeErrors = #', flag); 13 JS('', 'dart.__trapRuntimeErrors = #', flag);
14 } 14 }
15 15
16 void ignoreWhitelistedErrors(bool flag) { 16 void ignoreWhitelistedErrors(bool flag) {
17 JS('', 'dart.__ignoreWhitelistedErrors = #', flag); 17 JS('', 'dart.__ignoreWhitelistedErrors = #', flag);
18 } 18 }
19 19
20 void ignoreAllErrors(bool flag) { 20 void ignoreAllErrors(bool flag) {
21 JS('', 'dart.__ignoreAllErrors = #', flag); 21 JS('', 'dart.__ignoreAllErrors = #', flag);
22 } 22 }
23 23
24 /// Throw an exception on `is` checks that would return an unsound answer in
25 /// non-strong mode Dart.
26 ///
27 /// For example `x is List<int>` where `x = <Object>['hello']`.
28 ///
29 /// These checks behave correctly in strong mode (they return false), however,
30 /// they will produce a different answer if run on a platform without strong
31 /// mode. As a debugging feature, these checks can be configured to throw, to
32 /// avoid seeing different behavior between modes.
33 ///
34 /// (There are many other ways that different `is` behavior can be observed,
35 /// however, even with this flag. The most obvious is due to lack of reified
36 /// generic type parameters. This affects generic functions and methods, as
37 /// well as generic types when the type parameter was inferred. Setting this
38 /// flag to `true` will not catch these differences in behavior..)
39 void failForWeakModeIsChecks(bool flag) {
40 JS('', 'dart.__failForWeakModeIsChecks = #', flag);
41 }
42
43 throwCastError(object, actual, type) { 24 throwCastError(object, actual, type) {
44 var found = typeName(actual); 25 var found = typeName(actual);
45 var expected = typeName(type); 26 var expected = typeName(type);
46 if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger'); 27 if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger');
47 throw new CastErrorImplementation(object, found, expected); 28 throw new CastErrorImplementation(object, found, expected);
48 } 29 }
49 30
50 throwTypeError(object, actual, type) { 31 throwTypeError(object, actual, type) {
51 var found = typeName(actual); 32 var found = typeName(actual);
52 var expected = typeName(type); 33 var expected = typeName(type);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 throw new NoSuchMethodError( 72 throw new NoSuchMethodError(
92 null, new Symbol('<Unexpected Null Value>'), null, null, null); 73 null, new Symbol('<Unexpected Null Value>'), null, null, null);
93 } 74 }
94 75
95 throwNoSuchMethodError(Object receiver, Symbol memberName, 76 throwNoSuchMethodError(Object receiver, Symbol memberName,
96 List positionalArguments, Map<Symbol, dynamic> namedArguments) { 77 List positionalArguments, Map<Symbol, dynamic> namedArguments) {
97 if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger'); 78 if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger');
98 throw new NoSuchMethodError( 79 throw new NoSuchMethodError(
99 receiver, memberName, positionalArguments, namedArguments); 80 receiver, memberName, positionalArguments, namedArguments);
100 } 81 }
OLDNEW
« no previous file with comments | « pkg/dev_compiler/test/browser/runtime_tests.js ('k') | pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/generators.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698