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

Unified Diff: tool/input_sdk/private/ddc_runtime/utils.dart

Issue 2026133002: Throw TypeError instead of CastError for type coercions. (Closed) Base URL: https://github.com/dart-lang/dev_compiler@master
Patch Set: Created 4 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: tool/input_sdk/private/ddc_runtime/utils.dart
diff --git a/tool/input_sdk/private/ddc_runtime/utils.dart b/tool/input_sdk/private/ddc_runtime/utils.dart
index 62b49d0e73960c686ee367091628345d687a2042..0a3e17621e50da77daa92ebd2b7438590d447386 100644
--- a/tool/input_sdk/private/ddc_runtime/utils.dart
+++ b/tool/input_sdk/private/ddc_runtime/utils.dart
@@ -21,19 +21,10 @@ Iterable getOwnPropertySymbols(obj) =>
final hasOwnProperty = JS('', 'Object.prototype.hasOwnProperty');
-// TODO(ochafik): Add ES6 class syntax support to JS intrinsics to avoid this.
-final StrongModeError = JS('', '''(function() {
- function StrongModeError(message) {
- Error.call(this);
- this.message = message;
- };
- Object.setPrototypeOf(StrongModeError.prototype, Error.prototype);
- return StrongModeError;
-})()''');
-
-/// This error indicates a strong mode specific failure.
+/// This error indicates a strong mode specific failure, other than a type
+/// assertion failure (TypeError) or CastError.
void throwStrongModeError(String message) {
- JS('', 'throw new #(#);', StrongModeError, message);
+ JS('', 'throw new #(#);', StrongModeErrorImplementation, message);
}
/// This error indicates a bug in the runtime or the compiler.

Powered by Google App Engine
This is Rietveld 408576698