| Index: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/errors.dart
|
| diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/errors.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/errors.dart
|
| index 156539e2bd43900d5dcaae84174a779b9b840c90..dfaa87289a5dfd7627c916505da391177ec4472b 100644
|
| --- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/errors.dart
|
| +++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/errors.dart
|
| @@ -5,6 +5,7 @@ part of dart._runtime;
|
|
|
| bool _trapRuntimeErrors = true;
|
| bool _ignoreWhitelistedErrors = true;
|
| +bool _failForWeakModeIsChecks = true;
|
|
|
| // Override, e.g., for testing
|
| void trapRuntimeErrors(bool flag) {
|
| @@ -15,6 +16,25 @@ void ignoreWhitelistedErrors(bool flag) {
|
| _ignoreWhitelistedErrors = flag;
|
| }
|
|
|
| +/// Throw an exception on `is` checks that would return an unsound answer in
|
| +/// non-strong mode Dart.
|
| +///
|
| +/// For example `x is List<int>` where `x = <Object>['hello']`.
|
| +///
|
| +/// These checks behave correctly in strong mode (they return false), however,
|
| +/// they will produce a different answer if run on a platform without strong
|
| +/// mode. As a debugging feature, these checks can be configured to throw, to
|
| +/// avoid seeing different behavior between modes.
|
| +///
|
| +/// (There are many other ways that different `is` behavior can be observed,
|
| +/// however, even with this flag. The most obvious is due to lack of reified
|
| +/// generic type parameters. This affects generic functions and methods, as
|
| +/// well as generic types when the type parameter was inferred. Setting this
|
| +/// flag to `true` will not catch these differences in behavior..)
|
| +void failForWeakModeIsChecks(bool flag) {
|
| + _failForWeakModeIsChecks = flag;
|
| +}
|
| +
|
| throwCastError(object, actual, type) => JS(
|
| '',
|
| '''(() => {
|
|
|