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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/ast.cc » ('j') | runtime/vm/flow_graph_builder.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // Errors are created and thrown by DartVM only. 4 // Errors are created and thrown by DartVM only.
5 // Changes here should also be reflected in corelib/error.dart as well 5 // Changes here should also be reflected in corelib/error.dart as well
6 6
7 class AssertionError { 7 class AssertionError {
8 factory AssertionError._uninstantiable() { 8 factory AssertionError._uninstantiable() {
9 throw const UnsupportedOperationException( 9 throw const UnsupportedOperationException(
10 "AssertionError can only be allocated by the VM"); 10 "AssertionError can only be allocated by the VM");
(...skipping 30 matching lines...) Expand all
41 str = "${str}malformed type used."; 41 str = "${str}malformed type used.";
42 } 42 }
43 return str; 43 return str;
44 } 44 }
45 final String srcType; 45 final String srcType;
46 final String dstType; 46 final String dstType;
47 final String dstName; 47 final String dstName;
48 final String malformedError; 48 final String malformedError;
49 } 49 }
50 50
51 class CastException extends TypeError {
52 factory CastException._uninstantiable() {
53 throw const UnsupportedOperationException(
54 "CastException can only be allocated by the VM");
55 }
56 // A CastException is allocated by TypeError._throwNew() with "type cast" as
57 // dst_name.
58 String toString() {
59 String str = (malformedError != null) ? malformedError : "";
60 if ((dstName != null) && (dstName.length > 0)) {
61 str = "${str}type '$srcType' is not a subtype of "
62 "type '$dstType' in type cast.";
63 } else {
64 str = "${str}malformed type used in type cast.";
65 }
66 return str;
67 }
68 }
69
51 class FallThroughError { 70 class FallThroughError {
52 factory FallThroughError._uninstantiable() { 71 factory FallThroughError._uninstantiable() {
53 throw const UnsupportedOperationException( 72 throw const UnsupportedOperationException(
54 "FallThroughError can only be allocated by the VM"); 73 "FallThroughError can only be allocated by the VM");
55 } 74 }
56 static _throwNew(int case_clause_pos) native "FallThroughError_throwNew"; 75 static _throwNew(int case_clause_pos) native "FallThroughError_throwNew";
57 String toString() { 76 String toString() {
58 return "'$url': Switch case fall-through at line $line."; 77 return "'$url': Switch case fall-through at line $line.";
59 } 78 }
60 final String url; 79 final String url;
(...skipping 16 matching lines...) Expand all
77 String toString() => "Unresolved static method: url '$url' line $line " 96 String toString() => "Unresolved static method: url '$url' line $line "
78 "pos $column\n$failedResolutionLine\n"; 97 "pos $column\n$failedResolutionLine\n";
79 98
80 static _throwNew(int token_pos) native "StaticResolutionException_throwNew"; 99 static _throwNew(int token_pos) native "StaticResolutionException_throwNew";
81 100
82 final String failedResolutionLine; 101 final String failedResolutionLine;
83 final String url; 102 final String url;
84 final int line; 103 final int line;
85 final int column; 104 final int column;
86 } 105 }
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/ast.cc » ('j') | runtime/vm/flow_graph_builder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698