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

Unified Diff: runtime/lib/error.dart

Issue 10659005: Implement type cast in the VM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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
« no previous file with comments | « no previous file | runtime/vm/ast.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/error.dart
===================================================================
--- runtime/lib/error.dart (revision 9069)
+++ runtime/lib/error.dart (working copy)
@@ -48,6 +48,25 @@
final String malformedError;
}
+class CastException extends TypeError {
+ factory CastException._uninstantiable() {
+ throw const UnsupportedOperationException(
+ "CastException can only be allocated by the VM");
+ }
+ // A CastException is allocated by TypeError._throwNew() when dst_name equals
+ // Exceptions::kCastExceptionDstName.
+ String toString() {
+ String str = (malformedError != null) ? malformedError : "";
+ if ((dstName != null) && (dstName.length > 0)) {
+ str = "${str}type '$srcType' is not a subtype of "
+ "type '$dstType' in type cast.";
+ } else {
+ str = "${str}malformed type used in type cast.";
+ }
+ return str;
+ }
+}
+
class FallThroughError {
factory FallThroughError._uninstantiable() {
throw const UnsupportedOperationException(
« no previous file with comments | « no previous file | runtime/vm/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698