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

Side by Side Diff: frog/world.dart

Issue 8481023: cleanup errors and fix a couple field negative tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 1 month 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 | « frog/value.dart ('k') | tests/language/language.status » ('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 /** 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 353
354 resolveAll() { 354 resolveAll() {
355 for (var lib in libraries.getValues()) { 355 for (var lib in libraries.getValues()) {
356 lib.resolve(); 356 lib.resolve();
357 } 357 }
358 } 358 }
359 359
360 // ********************** Message support *********************** 360 // ********************** Message support ***********************
361 361
362 void _message(String message, SourceSpan span, SourceSpan span1, 362 void _message(String message, SourceSpan span, SourceSpan span1,
363 bool throwing) { 363 SourceSpan span2, bool throwing) {
364 var text = message; 364 var text = message;
365 if (span != null) { 365 if (span != null) {
366 text = span.toMessageString(message); 366 text = span.toMessageString(message);
367 } 367 }
368 print(text); 368 print(text);
369 if (span1 != null) { 369 if (span1 != null) {
370 print(span1.toMessageString(message)); 370 print(span1.toMessageString(message));
371 } 371 }
372 if (span2 != null) {
373 print(span2.toMessageString(message));
374 }
372 375
373 if (throwing) { 376 if (throwing) {
374 throw new CompilerException(message, span); 377 throw new CompilerException(message, span);
375 } 378 }
376 } 379 }
377 380
378 /** [message] is considered a static compile-time error by the Dart lang. */ 381 /** [message] is considered a static compile-time error by the Dart lang. */
379 void error(String message, [SourceSpan span, SourceSpan span1]) { 382 void error(String message, [SourceSpan span, SourceSpan span1, SourceSpan span 2]) {
380 errors++; 383 errors++;
381 _message('error: $message', span, span1, options.throwOnErrors); 384 _message('error: $message', span, span1, span2, options.throwOnErrors);
382 } 385 }
383 386
384 /** [message] is considered a type warning by the Dart lang. */ 387 /** [message] is considered a type warning by the Dart lang. */
385 void warning(String message, [SourceSpan span, SourceSpan span1]) { 388 void warning(String message, [SourceSpan span, SourceSpan span1, SourceSpan sp an2]) {
386 warnings++; 389 warnings++;
387 if (options.showWarnings) { 390 if (options.showWarnings) {
388 _message('warning: $message', span, span1, options.throwOnWarnings); 391 _message('warning: $message', span, span1, span2, options.throwOnWarnings) ;
389 } 392 }
390 } 393 }
391 394
392 /** [message] at [location] is so bad we can't generate runnable code. */ 395 /** [message] at [location] is so bad we can't generate runnable code. */
393 void fatal(String message, [SourceSpan span, SourceSpan span1]) { 396 void fatal(String message, [SourceSpan span, SourceSpan span1, SourceSpan span 2]) {
394 errors++; 397 errors++;
395 seenFatal = true; 398 seenFatal = true;
396 _message('fatal: $message', span, span1, 399 _message('fatal: $message', span, span1, span2,
397 options.throwOnFatal || options.throwOnErrors); 400 options.throwOnFatal || options.throwOnErrors);
398 } 401 }
399 402
400 /** [message] at [location] is about a bug in the compiler. */ 403 /** [message] at [location] is about a bug in the compiler. */
401 void internalError(String message, [SourceSpan span, SourceSpan span1]) { 404 void internalError(String message, [SourceSpan span, SourceSpan span1, SourceS pan span2]) {
402 _message('We are sorry, but... $message', span, span1, true); 405 _message('We are sorry, but... $message', span, span1, span2, true);
403 } 406 }
404 407
405 /** 408 /**
406 * [message] at [location] will tell the user about what the compiler 409 * [message] at [location] will tell the user about what the compiler
407 * is doing. 410 * is doing.
408 */ 411 */
409 void info(String message, [SourceSpan span, SourceSpan span1]) { 412 void info(String message, [SourceSpan span, SourceSpan span1, SourceSpan span2 ]) {
410 if (options.showInfo) { 413 if (options.showInfo) {
411 _message('info: $message', span, span1, false); 414 _message('info: $message', span, span1, span2, false);
412 } 415 }
413 } 416 }
414 417
415 bool get hasErrors() => errors > 0; 418 bool get hasErrors() => errors > 0;
416 419
417 void printStatus() { 420 void printStatus() {
418 info('compiled $dartBytesRead bytes Dart -> $jsBytesWritten bytes JS'); 421 info('compiled $dartBytesRead bytes Dart -> $jsBytesWritten bytes JS');
419 if (hasErrors) { 422 if (hasErrors) {
420 print('compilation failed with $errors errors'); 423 print('compilation failed with $errors errors');
421 } else { 424 } else {
422 if (warnings > 0) { 425 if (warnings > 0) {
423 info('compilation completed successfully with $warnings warnings'); 426 info('compilation completed successfully with $warnings warnings');
424 } else { 427 } else {
425 info('compilation completed sucessfully'); 428 info('compilation completed sucessfully');
426 } 429 }
427 } 430 }
428 } 431 }
429 432
430 withTiming(String name, f()) { 433 withTiming(String name, f()) {
431 final sw = new StopWatch(); 434 final sw = new StopWatch();
432 sw.start(); 435 sw.start();
433 var result = f(); 436 var result = f();
434 sw.stop(); 437 sw.stop();
435 info('$name in ${sw.elapsedInMs()}msec'); 438 info('$name in ${sw.elapsedInMs()}msec');
436 return result; 439 return result;
437 } 440 }
438 } 441 }
OLDNEW
« no previous file with comments | « frog/value.dart ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698