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

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

Issue 9639012: Implement the compiler API and use it in frog_leg.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments and created separate implementation library 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
« no previous file with comments | « no previous file | dart/frog/leg/apiimpl.dart » ('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) 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('leg_api'); 5 #library('leg_api');
6 #import('dart:uri'); 6
7 #import('../../lib/uri/uri.dart');
8 #import('apiimpl.dart');
7 9
8 // Unless explicitly allowed, passing null for any argument to the 10 // Unless explicitly allowed, passing null for any argument to the
9 // methods of library will result in a NullPointerException being 11 // methods of library will result in a NullPointerException being
10 // thrown. 12 // thrown.
11 13
12 /** 14 /**
13 * Returns the source corresponding to [uri]. If no such source exists 15 * Returns the source corresponding to [uri]. If no such source exists
14 * or if an error occur while fetching it, this method must throw an 16 * or if an error occur while fetching it, this method must throw an
15 * exception. 17 * exception.
16 */ 18 */
(...skipping 10 matching lines...) Expand all
27 * from returning null. 29 * from returning null.
28 */ 30 */
29 typedef void DiagnosticHandler(Uri uri, int begin, int end, 31 typedef void DiagnosticHandler(Uri uri, int begin, int end,
30 String message, bool fatal); 32 String message, bool fatal);
31 33
32 /** 34 /**
33 * Returns [script] compiled to JavaScript. If the compilation fails, 35 * Returns [script] compiled to JavaScript. If the compilation fails,
34 * null is returned and [handler] will have been invoked at least once 36 * null is returned and [handler] will have been invoked at least once
35 * with [:fatal == true:]. 37 * with [:fatal == true:].
36 */ 38 */
37 Future<String> compile(Uri script, Uri libraryRoot, 39 Future<String> compile(Uri script,
38 ReadUriFromString provider, DiagnosticHandler handler); 40 Uri libraryRoot,
39 // TODO(ahe): Document libraryRoot argument. 41 ReadUriFromString provider,
42 DiagnosticHandler handler) {
43 Compiler compiler = new Compiler(provider, handler, libraryRoot);
44 compiler.run(script);
45 String code = compiler.assembledCode;
46 Completer<String> completer = new Completer<String>();
47 completer.complete(code);
48 return completer.future;
49 }
OLDNEW
« no previous file with comments | « no previous file | dart/frog/leg/apiimpl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698