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

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
« no previous file with comments | « runtime/lib/error.cc ('k') | runtime/vm/bootstrap_natives.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
36 if (malformedError != null) {
37 return malformedError;
38 }
35 return "'$url': Failed type check: line $line pos $column: " + 39 return "'$url': Failed type check: line $line pos $column: " +
36 "type '$srcType' is not assignable to type '$dstType' of '$dstName'."; 40 "type '$srcType' is not assignable to type '$dstType' of '$dstName'.";
37 } 41 }
38 final String srcType; 42 final String srcType;
39 final String dstType; 43 final String dstType;
40 final String dstName; 44 final String dstName;
45 final String malformedError;
41 } 46 }
42 47
43 class FallThroughError { 48 class FallThroughError {
44 factory FallThroughError._uninstantiable() { 49 factory FallThroughError._uninstantiable() {
45 throw const UnsupportedOperationException( 50 throw const UnsupportedOperationException(
46 "FallThroughError can only be allocated by the VM"); 51 "FallThroughError can only be allocated by the VM");
47 } 52 }
48 static _throwNew(int case_clause_pos) native "FallThroughError_throwNew"; 53 static _throwNew(int case_clause_pos) native "FallThroughError_throwNew";
49 String toString() { 54 String toString() {
50 return "'$url': Switch case fall-through at line $line."; 55 return "'$url': Switch case fall-through at line $line.";
(...skipping 12 matching lines...) Expand all
63 class StaticResolutionException implements Exception { 68 class StaticResolutionException implements Exception {
64 factory StaticResolutionException._uninstantiable() { 69 factory StaticResolutionException._uninstantiable() {
65 throw const UnsupportedOperationException( 70 throw const UnsupportedOperationException(
66 "StaticResolutionException can only be allocated by the VM"); 71 "StaticResolutionException can only be allocated by the VM");
67 } 72 }
68 73
69 String toString() => "Unresolved static method: url '$url' line $line " + 74 String toString() => "Unresolved static method: url '$url' line $line " +
70 "pos $column\n$failedResolutionLine\n"; 75 "pos $column\n$failedResolutionLine\n";
71 76
72 static _throwNew(int token_pos) native "StaticResolutionException_throwNew"; 77 static _throwNew(int token_pos) native "StaticResolutionException_throwNew";
73 78
74 final String failedResolutionLine; 79 final String failedResolutionLine;
75 final String url; 80 final String url;
76 final int line; 81 final int line;
77 final int column; 82 final int column;
78 } 83 }
OLDNEW
« no previous file with comments | « runtime/lib/error.cc ('k') | runtime/vm/bootstrap_natives.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698