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

Side by Side Diff: runtime/lib/error.dart

Issue 9515011: Add support for malformed types and postpone some related errors from compile (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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
OLDNEW
1 // Copyright (c) 2011, 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");
11 } 11 }
(...skipping 10 matching lines...) Expand all
22 } 22 }
23 23
24 class TypeError extends AssertionError { 24 class TypeError extends AssertionError {
25 factory TypeError._uninstantiable() { 25 factory TypeError._uninstantiable() {
26 throw const UnsupportedOperationException( 26 throw const UnsupportedOperationException(
27 "TypeError can only be allocated by the VM"); 27 "TypeError can only be allocated by the VM");
28 } 28 }
29 static _throwNew(int location, 29 static _throwNew(int location,
30 Object src_value, 30 Object src_value,
31 String dst_type_name, 31 String dst_type_name,
32 String dst_name) 32 String dst_name,
33 String malformed_error)
33 native "TypeError_throwNew"; 34 native "TypeError_throwNew";
34 String toString() { 35 String toString() {
35 return "'$url': Failed type check: line $line pos $column: " + 36 if (malformedError != null) {
36 "type '$srcType' is not assignable to type '$dstType' of '$dstName'."; 37 return malformedError;
38 } else {
39 return "'$url': Failed type check: line $line pos $column: " +
srdjan 2012/02/29 00:15:54 no else is needed
regis 2012/02/29 02:10:01 Done.
40 "type '$srcType' is not assignable to type '$dstType' of '$dstName'.";
41 }
37 } 42 }
38 final String srcType; 43 final String srcType;
39 final String dstType; 44 final String dstType;
40 final String dstName; 45 final String dstName;
46 final String malformedError;
41 } 47 }
42 48
43 class FallThroughError { 49 class FallThroughError {
44 factory FallThroughError._uninstantiable() { 50 factory FallThroughError._uninstantiable() {
45 throw const UnsupportedOperationException( 51 throw const UnsupportedOperationException(
46 "FallThroughError can only be allocated by the VM"); 52 "FallThroughError can only be allocated by the VM");
47 } 53 }
48 static _throwNew(int case_clause_pos) native "FallThroughError_throwNew"; 54 static _throwNew(int case_clause_pos) native "FallThroughError_throwNew";
49 String toString() { 55 String toString() {
50 return "'$url': Switch case fall-through at line $line."; 56 return "'$url': Switch case fall-through at line $line.";
(...skipping 12 matching lines...) Expand all
63 class StaticResolutionException implements Exception { 69 class StaticResolutionException implements Exception {
64 factory StaticResolutionException._uninstantiable() { 70 factory StaticResolutionException._uninstantiable() {
65 throw const UnsupportedOperationException( 71 throw const UnsupportedOperationException(
66 "StaticResolutionException can only be allocated by the VM"); 72 "StaticResolutionException can only be allocated by the VM");
67 } 73 }
68 74
69 String toString() => "Unresolved static method: url '$url' line $line " + 75 String toString() => "Unresolved static method: url '$url' line $line " +
70 "pos $column\n$failedResolutionLine\n"; 76 "pos $column\n$failedResolutionLine\n";
71 77
72 static _throwNew(int token_pos) native "StaticResolutionException_throwNew"; 78 static _throwNew(int token_pos) native "StaticResolutionException_throwNew";
73 79
74 final String failedResolutionLine; 80 final String failedResolutionLine;
75 final String url; 81 final String url;
76 final int line; 82 final int line;
77 final int column; 83 final int column;
78 } 84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698