Chromium Code Reviews| 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 * Experimental phase to enable await, only set when using the | 9 * Experimental phase to enable await, only set when using the |
| 10 * await/awaitc.dart entrypoint. | 10 * await/awaitc.dart entrypoint. |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 399 if (span2 != null) { | 399 if (span2 != null) { |
| 400 print(span2.toMessageString(message)); | 400 print(span2.toMessageString(message)); |
| 401 } | 401 } |
| 402 | 402 |
| 403 if (throwing) { | 403 if (throwing) { |
| 404 throw new CompilerException(message, span); | 404 throw new CompilerException(message, span); |
| 405 } | 405 } |
| 406 } | 406 } |
| 407 | 407 |
| 408 /** [message] is considered a static compile-time error by the Dart lang. */ | 408 /** [message] is considered a static compile-time error by the Dart lang. */ |
| 409 void error(String message, [SourceSpan span, SourceSpan span1, SourceSpan span 2]) { | 409 void error(String message, |
| 410 [SourceSpan span, SourceSpan span1, SourceSpan span2]) { | |
| 410 errors++; | 411 errors++; |
| 411 _message('error: $message', span, span1, span2, options.throwOnErrors); | 412 _message(options.useColors |
| 413 ? '${_RED_COLOR}error$_NO_COLOR: $message' : 'error: $message', | |
|
Bob Nystrom
2011/12/06 22:47:43
This seems a bit redundant. How about having _mess
Siggi Cherem (dart-lang)
2011/12/06 23:37:38
Done.
| |
| 414 span, span1, span2, options.throwOnErrors); | |
| 412 } | 415 } |
| 413 | 416 |
| 414 /** [message] is considered a type warning by the Dart lang. */ | 417 /** [message] is considered a type warning by the Dart lang. */ |
| 415 void warning(String message, [SourceSpan span, SourceSpan span1, SourceSpan sp an2]) { | 418 void warning(String message, |
| 419 [SourceSpan span, SourceSpan span1, SourceSpan span2]) { | |
| 416 if (options.warningsAsErrors) { | 420 if (options.warningsAsErrors) { |
| 417 error(message, span, span1, span2); | 421 error(message, span, span1, span2); |
| 418 return; | 422 return; |
| 419 } | 423 } |
| 420 warnings++; | 424 warnings++; |
| 421 if (options.showWarnings) { | 425 if (options.showWarnings) { |
| 422 _message('warning: $message', span, span1, span2, options.throwOnWarnings) ; | 426 _message(options.useColors |
| 427 ? '${_MAGENTA_COLOR}warning$_NO_COLOR: $message' | |
| 428 : 'warning: $message', span, span1, span2, options.throwOnWarnings); | |
| 423 } | 429 } |
| 424 } | 430 } |
| 425 | 431 |
| 426 /** [message] at [location] is so bad we can't generate runnable code. */ | 432 /** [message] at [location] is so bad we can't generate runnable code. */ |
| 427 void fatal(String message, [SourceSpan span, SourceSpan span1, SourceSpan span 2]) { | 433 void fatal(String message, |
| 434 [SourceSpan span, SourceSpan span1, SourceSpan span2]) { | |
| 428 errors++; | 435 errors++; |
| 429 seenFatal = true; | 436 seenFatal = true; |
| 430 _message('fatal: $message', span, span1, span2, | 437 _message(options.useColors |
| 431 options.throwOnFatal || options.throwOnErrors); | 438 ? '${_RED_COLOR}fatal$_NO_COLOR: $message' : 'fatal: $message', |
| 439 span, span1, span2, options.throwOnFatal || options.throwOnErrors); | |
| 432 } | 440 } |
| 433 | 441 |
| 434 /** [message] at [location] is about a bug in the compiler. */ | 442 /** [message] at [location] is about a bug in the compiler. */ |
| 435 void internalError(String message, [SourceSpan span, SourceSpan span1, SourceS pan span2]) { | 443 void internalError(String message, |
| 444 [SourceSpan span, SourceSpan span1, SourceSpan span2]) { | |
| 436 _message('We are sorry, but... $message', span, span1, span2, true); | 445 _message('We are sorry, but... $message', span, span1, span2, true); |
| 437 } | 446 } |
| 438 | 447 |
| 439 /** | 448 /** |
| 440 * [message] at [location] will tell the user about what the compiler | 449 * [message] at [location] will tell the user about what the compiler |
| 441 * is doing. | 450 * is doing. |
| 442 */ | 451 */ |
| 443 void info(String message, [SourceSpan span, SourceSpan span1, SourceSpan span2 ]) { | 452 void info(String message, [SourceSpan span, SourceSpan span1, SourceSpan span2 ]) { |
| 444 if (options.showInfo) { | 453 if (options.showInfo) { |
| 445 _message('info: $message', span, span1, span2, false); | 454 _message('info: $message', span, span1, span2, false); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 475 | 484 |
| 476 withTiming(String name, f()) { | 485 withTiming(String name, f()) { |
| 477 final sw = new Stopwatch(); | 486 final sw = new Stopwatch(); |
| 478 sw.start(); | 487 sw.start(); |
| 479 var result = f(); | 488 var result = f(); |
| 480 sw.stop(); | 489 sw.stop(); |
| 481 info('$name in ${sw.elapsedInMs()}msec'); | 490 info('$name in ${sw.elapsedInMs()}msec'); |
| 482 return result; | 491 return result; |
| 483 } | 492 } |
| 484 } | 493 } |
| OLD | NEW |