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

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

Issue 11049038: Change compile-time errors into dynamic errors in instance creation expression (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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/ast.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 AssertionErrorImplementation implements AssertionError { 7 class AssertionErrorImplementation implements AssertionError {
8 factory AssertionErrorImplementation._uninstantiable() { 8 factory AssertionErrorImplementation._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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 final int line; 84 final int line;
85 } 85 }
86 86
87 class InternalError { 87 class InternalError {
88 const InternalError(this._msg); 88 const InternalError(this._msg);
89 String toString() => "InternalError: '${_msg}'"; 89 String toString() => "InternalError: '${_msg}'";
90 final String _msg; 90 final String _msg;
91 } 91 }
92 92
93 93
94 class StaticResolutionException implements Exception { 94 // TODO(regis): This class will change once mirrors are available.
95 factory StaticResolutionException._uninstantiable() { 95 class NoSuchMethodErrorImplementation implements NoSuchMethodError {
96 factory NoSuchMethodErrorImplementation._uninstantiable() {
96 throw const UnsupportedOperationException( 97 throw const UnsupportedOperationException(
97 "StaticResolutionException can only be allocated by the VM"); 98 "NoSuchMethodError can only be allocated by the VM");
98 } 99 }
99 100
100 String toString() => "Unresolved static method: url '$url' line $line " 101 String toString() => "No such method: url '$url' line $line "
101 "pos $column\n$failedResolutionLine\n"; 102 "pos $column\n$failedResolutionLine\n";
102 103
103 static _throwNew(int token_pos) native "StaticResolutionException_throwNew"; 104 static _throwNew(int call_pos, String functionName)
105 native "NoSuchMethodError_throwNew";
104 106
107 final String functionName;
105 final String failedResolutionLine; 108 final String failedResolutionLine;
106 final String url; 109 final String url;
107 final int line; 110 final int line;
108 final int column; 111 final int column;
109 } 112 }
110 113
111 114
112 class AbstractClassInstantiationErrorImplementation 115 class AbstractClassInstantiationErrorImplementation
113 implements AbstractClassInstantiationError { 116 implements AbstractClassInstantiationError {
114 117
115 factory AbstractClassInstantiationErrorImplementation._uninstantiable() { 118 factory AbstractClassInstantiationErrorImplementation._uninstantiable() {
116 throw const UnsupportedOperationException( 119 throw const UnsupportedOperationException(
117 "AbstractClassInstantiationError can only be allocated by the VM"); 120 "AbstractClassInstantiationError can only be allocated by the VM");
118 } 121 }
119 122
120 static _throwNew(int case_clause_pos, String className) 123 static _throwNew(int case_clause_pos, String className)
121 native "AbstractClassInstantiationError_throwNew"; 124 native "AbstractClassInstantiationError_throwNew";
122 125
123 String toString() { 126 String toString() {
124 return "Cannot instantiate abstract class $className: " 127 return "Cannot instantiate abstract class $className: "
125 "url '$url' line $line"; 128 "url '$url' line $line";
126 } 129 }
127 130
128 final String className; 131 final String className;
129 final String url; 132 final String url;
130 final int line; 133 final int line;
131 } 134 }
OLDNEW
« no previous file with comments | « runtime/lib/error.cc ('k') | runtime/vm/ast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698