OLD | NEW |
---|---|
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('compiler'); | 5 #library('compiler'); |
6 | 6 |
7 #import('dart:uri'); | 7 #import('dart:uri'); |
8 #import('implementation/apiimpl.dart'); | 8 #import('implementation/apiimpl.dart'); |
9 | 9 |
10 // Unless explicitly allowed, passing [:null:] for any argument to the | 10 // Unless explicitly allowed, passing [:null:] for any argument to the |
(...skipping 25 matching lines...) Expand all Loading... | |
36 * the compilation fails, the future's value will be [:null:] and | 36 * the compilation fails, the future's value will be [:null:] and |
37 * [handler] will have been invoked at least once with [:kind == | 37 * [handler] will have been invoked at least once with [:kind == |
38 * Diagnostic.ERROR:] or [:kind == Diagnostic.CRASH:]. | 38 * Diagnostic.ERROR:] or [:kind == Diagnostic.CRASH:]. |
39 */ | 39 */ |
40 Future<String> compile(Uri script, | 40 Future<String> compile(Uri script, |
41 Uri libraryRoot, | 41 Uri libraryRoot, |
42 Uri packageRoot, | 42 Uri packageRoot, |
43 ReadStringFromUri provider, | 43 ReadStringFromUri provider, |
44 DiagnosticHandler handler, | 44 DiagnosticHandler handler, |
45 [List<String> options = const []]) { | 45 [List<String> options = const []]) { |
46 if (!libraryRoot.path.endsWith("/")) { | |
47 throw new ArgumentError("Library URI must end with a /"); | |
ahe
2012/11/05 15:58:42
Library URI -> libraryRoot
Johnni Winther
2012/11/05 16:23:29
Done.
| |
48 } | |
49 if (packageRoot != null && !packageRoot.path.endsWith("/")) { | |
50 throw new ArgumentError("Package URI must end with a /"); | |
ahe
2012/11/05 15:58:42
Package URI -> packageRoot
Johnni Winther
2012/11/05 16:23:29
Done.
| |
51 } | |
46 // TODO(ahe): Consider completing the future with an exception if | 52 // TODO(ahe): Consider completing the future with an exception if |
47 // code is null. | 53 // code is null. |
48 Compiler compiler = new Compiler(provider, handler, libraryRoot, packageRoot, | 54 Compiler compiler = new Compiler(provider, handler, libraryRoot, packageRoot, |
49 options); | 55 options); |
50 compiler.run(script); | 56 compiler.run(script); |
51 String code = compiler.assembledCode; | 57 String code = compiler.assembledCode; |
52 return new Future.immediate(code); | 58 return new Future.immediate(code); |
53 } | 59 } |
54 | 60 |
55 /** | 61 /** |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 final String name; | 118 final String name; |
113 | 119 |
114 /** | 120 /** |
115 * This constructor is not private to support user-defined | 121 * This constructor is not private to support user-defined |
116 * diagnostic kinds. | 122 * diagnostic kinds. |
117 */ | 123 */ |
118 const Diagnostic(this.ordinal, this.name); | 124 const Diagnostic(this.ordinal, this.name); |
119 | 125 |
120 String toString() => name; | 126 String toString() => name; |
121 } | 127 } |
OLD | NEW |