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

Side by Side Diff: dart/frog/leg/frog_leg.dart

Issue 9646030: Find diagnostic locations for use in new compiler API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 9 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
OLDNEW
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 #library('frog_leg'); 5 #library('frog_leg');
6 6
7 #import('../../lib/uri/uri.dart'); 7 #import('../../lib/uri/uri.dart');
8 #import('../lang.dart', prefix: 'frog'); 8 #import('../lang.dart', prefix: 'frog');
9 #import('api.dart', prefix: 'api'); 9 #import('api.dart', prefix: 'api');
10 #import('io/io.dart', prefix: 'io'); 10 #import('io/io.dart', prefix: 'io');
(...skipping 17 matching lines...) Expand all
28 Completer<String> completer = new Completer<String>(); 28 Completer<String> completer = new Completer<String>();
29 completer.complete(source); 29 completer.complete(source);
30 return completer.future; 30 return completer.future;
31 } 31 }
32 32
33 void handler(Uri uri, int begin, int end, String message, bool fatal) { 33 void handler(Uri uri, int begin, int end, String message, bool fatal) {
34 if (uri === null && !fatal) { 34 if (uri === null && !fatal) {
35 world.info('[leg] $message'); 35 world.info('[leg] $message');
36 return; 36 return;
37 } 37 }
38 print(message); 38 print('$uri:$begin:$end: $message');
39 if (fatal && throwOnError) new AbortLeg(message); 39 if (fatal && throwOnError) throw new AbortLeg(message);
40 } 40 }
41 41
42 // TODO(ahe): We expect the future to be complete and call value 42 // TODO(ahe): We expect the future to be complete and call value
43 // directly. In effect, we don't support truly asynchronous API. 43 // directly. In effect, we don't support truly asynchronous API.
44 String code = api.compile(uri, libraryRoot, provider, handler).value; 44 String code = api.compile(uri, libraryRoot, provider, handler).value;
45 if (code === null) return false; 45 if (code === null) return false;
46 world.legCode = code; 46 world.legCode = code;
47 world.jsBytesWritten = code.length; 47 world.jsBytesWritten = code.length;
48 return true; 48 return true;
49 } 49 }
50 50
51 class AbortLeg { 51 class AbortLeg {
52 final message; 52 final message;
53 AbortLeg(this.message); 53 AbortLeg(this.message);
54 toString() => 'Aborted due to --throw-on-error: $message'; 54 toString() => 'Aborted due to --throw-on-error: $message';
55 } 55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698