Chromium Code Reviews| Index: tool/input_sdk/private/js_helper.dart |
| diff --git a/tool/input_sdk/private/js_helper.dart b/tool/input_sdk/private/js_helper.dart |
| index 9048d0facc5d6e72471edf702ef79b1e60849278..8df5529ac0209e2256bd1d3e9f4bd67cd3acf5dd 100644 |
| --- a/tool/input_sdk/private/js_helper.dart |
| +++ b/tool/input_sdk/private/js_helper.dart |
| @@ -782,9 +782,9 @@ class TypeErrorImplementation extends Error implements TypeError { |
| /** |
| * Normal type error caused by a failed subtype test. |
| */ |
| - TypeErrorImplementation(Object value, String type) |
| - : message = "type '${Primitives.objectTypeName(value)}' is not a subtype " |
| - "of type '$type'"; |
| + TypeErrorImplementation(Object value, Object actualType, Object expectedType) |
| + : message = "Type '${actualType}' is not a subtype " |
| + "of type '${expectedType}'"; |
| TypeErrorImplementation.fromMessage(String this.message); |
| @@ -799,13 +799,40 @@ class CastErrorImplementation extends Error implements CastError { |
| /** |
| * Normal cast error caused by a failed type cast. |
| */ |
| - CastErrorImplementation(Object actualType, Object expectedType) |
| - : message = "CastError: Casting value of type $actualType to" |
| - " incompatible type $expectedType"; |
| + CastErrorImplementation(Object value, Object actualType, Object expectedType) |
|
Leaf
2016/06/01 17:01:51
Why the unused "value" parameter?
sra1
2016/06/01 17:07:13
I will add a TODO, but I would eventually like the
|
| + : message = "CastError: Casting value of type '$actualType' to" |
| + " incompatible type '$expectedType'"; |
| String toString() => message; |
| } |
| +/// Thrown by type assertions that fail in strong mode that would have passed in |
| +/// standard Dart. |
| +class StrongModeTypeError extends Error implements TypeError, StrongModeError { |
| + final String message; |
| + StrongModeTypeError(Object value, Object actualType, Object expectedType) |
| + : message = "Type '${actualType}' is not a subtype " |
| + "of type '${expectedType}' in strong mode"; |
| + String toString() => message; |
| +} |
| + |
| +/// Thrown by casts that fail in strong mode that would have passed in standard |
| +/// Dart. |
| +class StrongModeCastError extends Error implements CastError, StrongModeError { |
| + final String message; |
| + StrongModeCastError(Object value, Object actualType, Object expectedType) |
| + : message = "CastError: Casting value of type '$actualType' to" |
| + " type '$expectedType' which is incompatible in strong mode"; |
| + String toString() => message; |
| +} |
| + |
| +/// Used for Strong-mode errors other than type assertions and casts. |
| +class StrongModeErrorImplementation extends Error implements StrongModeError { |
| + final String message; |
| + StrongModeErrorImplementation(this.message); |
| + String toString() => message; |
| +} |
| + |
| class FallThroughErrorImplementation extends FallThroughError { |
| FallThroughErrorImplementation(); |
| String toString() => "Switch case fall-through."; |