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

Side by Side Diff: dart/frog/leg/warnings.dart

Issue 9447100: Return null from stringValue and call slowToString() instead of toString(). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: changes Created 8 years, 10 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 | « dart/frog/leg/universe.dart ('k') | dart/frog/tests/leg/src/ResolverTest.dart » ('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) 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 4
5 class MessageKind { 5 class MessageKind {
6 final String template; 6 final String template;
7 const MessageKind(this.template); 7 const MessageKind(this.template);
8 8
9 static final GENERIC = const MessageKind('#{1}'); 9 static final GENERIC = const MessageKind('#{1}');
10 10
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 final List arguments; 135 final List arguments;
136 String message; 136 String message;
137 137
138 Message(this.kind, this.arguments); 138 Message(this.kind, this.arguments);
139 139
140 String toString() { 140 String toString() {
141 if (message === null) { 141 if (message === null) {
142 message = kind.template; 142 message = kind.template;
143 int position = 1; 143 int position = 1;
144 for (var argument in arguments) { 144 for (var argument in arguments) {
145 message = message.replaceAll('#{${position++}}', argument.toString()); 145 String string = slowToString(argument);
146 message = message.replaceAll('#{${position++}}', string);
146 } 147 }
147 } 148 }
148 return message; 149 return message;
149 } 150 }
150 151
151 bool operator==(other) { 152 bool operator==(other) {
152 if (other is !Message) return false; 153 if (other is !Message) return false;
153 return (kind == other.kind) && (toString() == other.toString()); 154 return (kind == other.kind) && (toString() == other.toString());
154 } 155 }
156
157 String slowToString(object) {
158 if (object is SourceString) {
159 return object.slowToString();
160 } else {
161 return object.toString();
162 }
163 }
155 } 164 }
156 165
157 class TypeWarning { 166 class TypeWarning {
158 final Message message; 167 final Message message;
159 TypeWarning.message(this.message); 168 TypeWarning.message(this.message);
160 TypeWarning(MessageKind kind, List<Type> arguments) 169 TypeWarning(MessageKind kind, List<Type> arguments)
161 : message = new Message(kind, arguments); 170 : message = new Message(kind, arguments);
162 String toString() => message.toString(); 171 String toString() => message.toString();
163 } 172 }
164 173
(...skipping 13 matching lines...) Expand all
178 String toString() => message.toString(); 187 String toString() => message.toString();
179 } 188 }
180 189
181 class CompileTimeConstantError { 190 class CompileTimeConstantError {
182 final Message message; 191 final Message message;
183 CompileTimeConstantError.message(this.message); 192 CompileTimeConstantError.message(this.message);
184 CompileTimeConstantError(MessageKind kind, List<Type> arguments) 193 CompileTimeConstantError(MessageKind kind, List<Type> arguments)
185 : message = new Message(kind, arguments); 194 : message = new Message(kind, arguments);
186 String toString() => message.toString(); 195 String toString() => message.toString();
187 } 196 }
OLDNEW
« no previous file with comments | « dart/frog/leg/universe.dart ('k') | dart/frog/tests/leg/src/ResolverTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698