| OLD | NEW |
| 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 /** The one true [World]. */ | 5 /** The one true [World]. */ |
| 6 World world; | 6 World world; |
| 7 | 7 |
| 8 typedef void MessageHandler(String prefix, String message, SourceSpan span); | 8 typedef void MessageHandler(String prefix, String message, SourceSpan span); |
| 9 typedef void PrintHandler(String message); | 9 typedef void PrintHandler(String message); |
| 10 | 10 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 * [message] at [location] will tell the user about what the compiler | 144 * [message] at [location] will tell the user about what the compiler |
| 145 * is doing. | 145 * is doing. |
| 146 */ | 146 */ |
| 147 void info(String message, | 147 void info(String message, |
| 148 [SourceSpan span, SourceSpan span1, SourceSpan span2]) { | 148 [SourceSpan span, SourceSpan span1, SourceSpan span2]) { |
| 149 if (options.showInfo) { | 149 if (options.showInfo) { |
| 150 _message(_GREEN_COLOR, 'info: ', message, span, span1, span2, false); | 150 _message(_GREEN_COLOR, 'info: ', message, span, span1, span2, false); |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 | 153 |
| 154 bool get hasErrors() => errors > 0; | 154 bool get hasErrors => errors > 0; |
| 155 | 155 |
| 156 withTiming(String name, f()) { | 156 withTiming(String name, f()) { |
| 157 final sw = new Stopwatch(); | 157 final sw = new Stopwatch(); |
| 158 sw.start(); | 158 sw.start(); |
| 159 var result = f(); | 159 var result = f(); |
| 160 sw.stop(); | 160 sw.stop(); |
| 161 info('$name in ${sw.elapsedInMs()}msec'); | 161 info('$name in ${sw.elapsedInMs()}msec'); |
| 162 return result; | 162 return result; |
| 163 } | 163 } |
| 164 } | 164 } |
| 165 | 165 |
| 166 // Color constants used for generating messages. | 166 // Color constants used for generating messages. |
| 167 String _GREEN_COLOR = '\u001b[32m'; | 167 String _GREEN_COLOR = '\u001b[32m'; |
| 168 String _RED_COLOR = '\u001b[31m'; | 168 String _RED_COLOR = '\u001b[31m'; |
| 169 String _MAGENTA_COLOR = '\u001b[35m'; | 169 String _MAGENTA_COLOR = '\u001b[35m'; |
| 170 String _NO_COLOR = '\u001b[0m'; | 170 String _NO_COLOR = '\u001b[0m'; |
| OLD | NEW |