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

Unified Diff: tool/input_sdk/private/ddc_runtime/errors.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/errors.dart
diff --git a/tool/input_sdk/private/ddc_runtime/errors.dart b/tool/input_sdk/private/ddc_runtime/errors.dart
index 12436155ad87c3b1d496dcea2e2796455e44e3fc..c537c33a2c86ae96dc5ebc4633f67e3314e72dff 100644
--- a/tool/input_sdk/private/ddc_runtime/errors.dart
+++ b/tool/input_sdk/private/ddc_runtime/errors.dart
@@ -3,11 +3,30 @@
// BSD-style license that can be found in the LICENSE file.
part of dart._runtime;
-throwCastError(actual, type) => JS('', '''(() => {
- $throw_(new $CastErrorImplementation($typeName($actual),
+throwCastError(object, actual, type) => JS('', '''(() => {
+ $throw_(new $CastErrorImplementation($object,
+ $typeName($actual),
$typeName($type)));
})()''');
+throwTypeError(object, actual, type) => JS('', '''(() => {
+ $throw_(new $TypeErrorImplementation($object,
+ $typeName($actual),
+ $typeName($type)));
+})()''');
+
+throwStrongModeCastError(object, actual, type) => JS('', '''(() => {
+ $throw_(new $StrongModeCastError($object,
+ $typeName($actual),
+ $typeName($type)));
+})()''');
+
+throwStrongModeTypeError(object, actual, type) => JS('', '''(() => {
+ $throw_(new $StrongModeTypeError($object,
+ $typeName($actual),
+ $typeName($type)));
+})()''');
+
throwAssertionError() => JS('', '''(() => {
$throw_(new $AssertionError());
})()''');

Powered by Google App Engine
This is Rietveld 408576698