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

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

Issue 9615035: Generate dynamic type errors according to spec. (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/class_finalizer.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) 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 15 matching lines...) Expand all
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 String malformed_error)
34 native "TypeError_throwNew"; 34 native "TypeError_throwNew";
35 String toString() { 35 String toString() {
36 if (malformedError != null) { 36 String str = (malformedError != null) ? malformedError : "";
37 return malformedError; 37 if ((dstName != null) && (dstName.length > 0)) {
38 str = str +
39 "type '$srcType' is not assignable to type '$dstType' of '$dstName'.";
40 } else {
41 str = str + "malformed type used in type test.";
38 } 42 }
39 return "'$url': Failed type check: line $line pos $column: " + 43 return str;
40 "type '$srcType' is not assignable to type '$dstType' of '$dstName'.";
41 } 44 }
42 final String srcType; 45 final String srcType;
43 final String dstType; 46 final String dstType;
44 final String dstName; 47 final String dstName;
45 final String malformedError; 48 final String malformedError;
46 } 49 }
47 50
48 class FallThroughError { 51 class FallThroughError {
49 factory FallThroughError._uninstantiable() { 52 factory FallThroughError._uninstantiable() {
50 throw const UnsupportedOperationException( 53 throw const UnsupportedOperationException(
(...skipping 23 matching lines...) Expand all
74 String toString() => "Unresolved static method: url '$url' line $line " + 77 String toString() => "Unresolved static method: url '$url' line $line " +
75 "pos $column\n$failedResolutionLine\n"; 78 "pos $column\n$failedResolutionLine\n";
76 79
77 static _throwNew(int token_pos) native "StaticResolutionException_throwNew"; 80 static _throwNew(int token_pos) native "StaticResolutionException_throwNew";
78 81
79 final String failedResolutionLine; 82 final String failedResolutionLine;
80 final String url; 83 final String url;
81 final int line; 84 final int line;
82 final int column; 85 final int column;
83 } 86 }
OLDNEW
« no previous file with comments | « runtime/lib/error.cc ('k') | runtime/vm/class_finalizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698