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

Side by Side Diff: frog/world.dart

Issue 9007053: await in frog: partial support for try-catch blocks (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: '' Created 8 years, 12 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
« no previous file with comments | « frog/tests/await/src/await_test_helper.dart ('k') | no next file » | 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 * 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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 process(); 410 process();
411 return library; 411 return library;
412 } 412 }
413 413
414 resolveAll() { 414 resolveAll() {
415 for (var lib in libraries.getValues()) { 415 for (var lib in libraries.getValues()) {
416 lib.resolve(); 416 lib.resolve();
417 } 417 }
418 } 418 }
419 419
420 generateCode(Library lib) { 420 findMainMethod(Library lib) {
421 var mainMembers = lib.topType.resolveMember('main'); 421 var mainMembers = lib.topType.resolveMember('main');
422 var main = null; 422 var main = null;
423 if (mainMembers == null || mainMembers.members.length == 0) { 423 if (mainMembers == null || mainMembers.members.length == 0) {
424 fatal('no main method specified'); 424 fatal('no main method specified');
425 } else if (mainMembers.members.length > 1) { 425 } else if (mainMembers.members.length > 1) {
426 for (var m in mainMembers.members) { 426 for (var m in mainMembers.members) {
427 main = m; 427 main = m;
428 error('more than one main member (using last?)', main.span); 428 error('more than one main member (using last?)', main.span);
429 } 429 }
430 } else { 430 } else {
431 main = mainMembers.members[0]; 431 main = mainMembers.members[0];
432 } 432 }
433 return main;
434 }
433 435
436 generateCode(Library lib) {
434 var codeWriter = new CodeWriter(); 437 var codeWriter = new CodeWriter();
435 gen = new WorldGenerator(main, codeWriter); 438 gen = new WorldGenerator(findMainMethod(lib), codeWriter);
436 gen.run(); 439 gen.run();
437 jsBytesWritten = codeWriter.text.length; 440 jsBytesWritten = codeWriter.text.length;
438 } 441 }
439 442
440 // ********************** Message support *********************** 443 // ********************** Message support ***********************
441 444
442 void _message(String color, String prefix, String message, 445 void _message(String color, String prefix, String message,
443 SourceSpan span, SourceSpan span1, SourceSpan span2, bool throwing) { 446 SourceSpan span, SourceSpan span1, SourceSpan span2, bool throwing) {
444 if (messageHandler != null) { 447 if (messageHandler != null) {
445 // TODO(jimhug): Multiple spans cleaner... 448 // TODO(jimhug): Multiple spans cleaner...
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 553
551 withTiming(String name, f()) { 554 withTiming(String name, f()) {
552 final sw = new Stopwatch(); 555 final sw = new Stopwatch();
553 sw.start(); 556 sw.start();
554 var result = f(); 557 var result = f();
555 sw.stop(); 558 sw.stop();
556 info('$name in ${sw.elapsedInMs()}msec'); 559 info('$name in ${sw.elapsedInMs()}msec');
557 return result; 560 return result;
558 } 561 }
559 } 562 }
OLDNEW
« no previous file with comments | « frog/tests/await/src/await_test_helper.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698