| OLD | NEW |
| 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 /** The one true [World]. */ | 5 /** The one true [World]. */ |
| 6 World world; | 6 World world; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Should be called exactly once to setup singleton world. | 9 * Should be called exactly once to setup singleton world. |
| 10 * Can use world.reset() to reinitialize. | 10 * Can use world.reset() to reinitialize. |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 // TODO(jimhug): If dev mode then throw. | 255 // TODO(jimhug): If dev mode then throw. |
| 256 } else { | 256 } else { |
| 257 // TODO(jimhug): Handle these in world or in callers? | 257 // TODO(jimhug): Handle these in world or in callers? |
| 258 throw; | 258 throw; |
| 259 } | 259 } |
| 260 } | 260 } |
| 261 printStatus(); | 261 printStatus(); |
| 262 return !hasErrors; | 262 return !hasErrors; |
| 263 } | 263 } |
| 264 | 264 |
| 265 /** Returns true if Leg handled the compilation job. */ |
| 265 bool runLeg() { | 266 bool runLeg() { |
| 266 if (!options.enableLeg) return false; | 267 if (!options.enableLeg) return false; |
| 267 bool res = withTiming('try leg compile', () => leg.compile(this)); | 268 bool res = withTiming('try leg compile', () => leg.compile(this)); |
| 268 if (!res && options.legOnly) { | 269 if (!res && options.legOnly) { |
| 269 fatal("Leg could not compile ${options.dartScript}"); | 270 fatal("Leg could not compile ${options.dartScript}"); |
| 271 return true; // In --leg_only, always "handle" the compilation. |
| 270 } | 272 } |
| 271 return res; | 273 return res; |
| 272 } | 274 } |
| 273 | 275 |
| 274 void runCompilationPhases() { | 276 void runCompilationPhases() { |
| 275 final lib = withTiming('first pass', | 277 final lib = withTiming('first pass', |
| 276 () => processScript(options.dartScript)); | 278 () => processScript(options.dartScript)); |
| 277 | 279 |
| 278 withTiming('resolve top level', () { resolveAll(); }); | 280 withTiming('resolve top level', () { resolveAll(); }); |
| 279 | 281 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 | 434 |
| 433 withTiming(String name, f()) { | 435 withTiming(String name, f()) { |
| 434 final sw = new StopWatch(); | 436 final sw = new StopWatch(); |
| 435 sw.start(); | 437 sw.start(); |
| 436 var result = f(); | 438 var result = f(); |
| 437 sw.stop(); | 439 sw.stop(); |
| 438 info('$name in ${sw.elapsedInMs()}msec'); | 440 info('$name in ${sw.elapsedInMs()}msec'); |
| 439 return result; | 441 return result; |
| 440 } | 442 } |
| 441 } | 443 } |
| OLD | NEW |