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

Unified Diff: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart

Issue 2893803006: Add ignoreAllErrors option to dart:_runtime (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 side-by-side diff with in-line comments
Download patch
Index: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
index 9a7402572693d64a9797c53a3602a3d157c8df3e..d551ddc21a1e141cf06220356cf9625c07db1273 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
@@ -511,9 +511,14 @@ instanceOf(obj, type) => JS(
if (result !== null) return result;
if (!dart.__failForWeakModeIsChecks) return false;
let actual = $getReifiedType($obj);
- $throwStrongModeError('Strong mode is-check failure: ' +
- $typeName(actual) + ' does not soundly subtype ' +
- $typeName($type));
+ let message = 'Strong mode is-check failure: ' +
+ $typeName(actual) + ' does not soundly subtype ' +
+ $typeName($type);
+ if (!dart.__ignoreAllErrors) {
+ $throwStrongModeError(message);
+ }
+ console.error(message);
+ return true; // Match Dart 1.0 Semantics when ignoring errors.
})()''');
@JSExportName('as')
@@ -521,14 +526,24 @@ cast(obj, type) {
if (JS('bool', '# == #', type, dynamic) || obj == null) return obj;
bool result = strongInstanceOf(obj, type, true);
if (JS('bool', '#', result)) return obj;
- _throwCastError(obj, type, result);
+ if (JS('bool', '!dart.__ignoreAllErrors')) {
+ _throwCastError(obj, type, result);
+ }
+ JS('', 'console.error(#)',
+ 'Actual: ${typeName(getReifiedType(obj))} Expected: ${typeName(type)}');
+ return obj;
}
check(obj, type) {
if (JS('bool', '# == #', type, dynamic) || obj == null) return obj;
bool result = strongInstanceOf(obj, type, true);
if (JS('bool', '#', result)) return obj;
- _throwTypeError(obj, type, result);
+ if (JS('bool', '!dart.__ignoreAllErrors')) {
+ _throwTypeError(obj, type, result);
+ }
+ JS('', 'console.error(#)',
+ 'Actual: ${typeName(getReifiedType(obj))} Expected: ${typeName(type)}');
+ return obj;
}
bool test(obj) {

Powered by Google App Engine
This is Rietveld 408576698