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

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

Issue 8637018: Implement type checking of map literals (issue 221). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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) 2011, 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 }
12 static _throwNew(int assertionStart, int assertionEnd) 12 static _throwNew(int assertionStart, int assertionEnd)
13 native "AssertionError_throwNew"; 13 native "AssertionError_throwNew";
14 String toString() { 14 String toString() {
15 return "'$url': Failed assertion: line $line pos $column: " + 15 return "'$url': Failed assertion: line $line pos $column: " +
16 "'$failedAssertion' is not true."; 16 "'$failedAssertion' is not true.";
17 } 17 }
18 final String failedAssertion; 18 final String failedAssertion;
19 final String url; 19 final String url;
20 final int line; 20 final int line;
21 final int column; 21 final int column;
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,
30 Object src_value,
31 String dst_type_name,
32 String dst_name)
33 native "TypeError_throwNew";
29 String toString() { 34 String toString() {
30 return "'$url': Failed type check: line $line pos $column: " + 35 return "'$url': Failed type check: line $line pos $column: " +
31 "type '$srcType' is not assignable to type '$dstType' of '$dstName'."; 36 "type '$srcType' is not assignable to type '$dstType' of '$dstName'.";
32 } 37 }
33 final String srcType; 38 final String srcType;
34 final String dstType; 39 final String dstType;
35 final String dstName; 40 final String dstName;
36 } 41 }
37 42
38 class FallThroughError { 43 class FallThroughError {
39 factory FallThroughError._uninstantiable() { 44 factory FallThroughError._uninstantiable() {
40 throw const UnsupportedOperationException( 45 throw const UnsupportedOperationException(
41 "FallThroughError can only be allocated by the VM"); 46 "FallThroughError can only be allocated by the VM");
42 } 47 }
43 static _throwNew(int case_clause_pos) native "FallThroughError_throwNew"; 48 static _throwNew(int case_clause_pos) native "FallThroughError_throwNew";
44 String toString() { 49 String toString() {
45 return "'$url': Switch case fall-through at line $line."; 50 return "'$url': Switch case fall-through at line $line.";
46 } 51 }
47 final String url; 52 final String url;
48 final int line; 53 final int line;
49 } 54 }
50 55
51 class InternalError { 56 class InternalError {
52 const InternalError(this._msg); 57 const InternalError(this._msg);
53 String toString() => "InternalError: '${_msg}'"; 58 String toString() => "InternalError: '${_msg}'";
54 final String _msg; 59 final String _msg;
55 } 60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698