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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/compiler.dart

Issue 13467021: Register type for literal list/map. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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
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 4
5 part of dart2js; 5 part of dart2js;
6 6
7 /** 7 /**
8 * If true, print a warning for each method that was resolved, but not 8 * If true, print a warning for each method that was resolved, but not
9 * compiled. 9 * compiled.
10 */ 10 */
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 * be either a [:bool:] or a no-arg function returning a [:bool:]. 1244 * be either a [:bool:] or a no-arg function returning a [:bool:].
1245 * 1245 *
1246 * Use this method to provide better information for assertion by calling 1246 * Use this method to provide better information for assertion by calling
1247 * [invariant] as the argument to an [:assert:] statement: 1247 * [invariant] as the argument to an [:assert:] statement:
1248 * 1248 *
1249 * assert(invariant(position, isValid)); 1249 * assert(invariant(position, isValid));
1250 * 1250 *
1251 * [spannable] must be non-null and will be used to provide positional 1251 * [spannable] must be non-null and will be used to provide positional
1252 * information in the generated error message. 1252 * information in the generated error message.
1253 */ 1253 */
1254 bool invariant(Spannable spannable, var condition, {String message: null}) { 1254 bool invariant(Spannable spannable, var condition, {var message: null}) {
1255 // TODO(johnniwinther): Use [spannable] and [message] to provide better 1255 // TODO(johnniwinther): Use [spannable] and [message] to provide better
1256 // information on assertion errors. 1256 // information on assertion errors.
1257 if (condition is Function){ 1257 if (condition is Function){
1258 condition = condition(); 1258 condition = condition();
1259 } 1259 }
1260 if (spannable == null || !condition) { 1260 if (spannable == null || !condition) {
1261 if (message is Function) {
1262 message = message();
1263 }
1261 throw new SpannableAssertionFailure(spannable, message); 1264 throw new SpannableAssertionFailure(spannable, message);
1262 } 1265 }
1263 return true; 1266 return true;
1264 } 1267 }
1265 1268
1266 /// A sink that drains into /dev/null. 1269 /// A sink that drains into /dev/null.
1267 class NullSink implements EventSink<String> { 1270 class NullSink implements EventSink<String> {
1268 final String name; 1271 final String name;
1269 1272
1270 NullSink(this.name); 1273 NullSink(this.name);
1271 1274
1272 add(String value) {} 1275 add(String value) {}
1273 1276
1274 void addError(AsyncError error) {} 1277 void addError(AsyncError error) {}
1275 1278
1276 void close() {} 1279 void close() {}
1277 1280
1278 toString() => name; 1281 toString() => name;
1279 1282
1280 /// Convenience method for getting an [api.CompilerOutputProvider]. 1283 /// Convenience method for getting an [api.CompilerOutputProvider].
1281 static NullSink outputProvider(String name, String extension) { 1284 static NullSink outputProvider(String name, String extension) {
1282 return new NullSink('$name.$extension'); 1285 return new NullSink('$name.$extension');
1283 } 1286 }
1284 } 1287 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698