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('dart2js'); | 5 #library('dart2js'); |
6 | 6 |
7 #import('dart:io'); | 7 #import('dart:io'); |
8 #import('dart:uri'); | 8 #import('dart:uri'); |
9 #import('dart:utf'); | 9 #import('dart:utf'); |
10 | 10 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 // TODO(ahe): We expect the future to be complete and call value | 154 // TODO(ahe): We expect the future to be complete and call value |
155 // directly. In effect, we don't support truly asynchronous API. | 155 // directly. In effect, we don't support truly asynchronous API. |
156 String code = api.compile(uri, libraryRoot, provider, handler, options).value; | 156 String code = api.compile(uri, libraryRoot, provider, handler, options).value; |
157 if (code === null) { | 157 if (code === null) { |
158 fail('Error: Compilation failed.'); | 158 fail('Error: Compilation failed.'); |
159 } | 159 } |
160 writeString(out, code); | 160 writeString(out, code); |
161 int jsBytesWritten = code.length; | 161 int jsBytesWritten = code.length; |
162 info('compiled $dartBytesRead bytes Dart -> $jsBytesWritten bytes JS ' | 162 info('compiled $dartBytesRead bytes Dart -> $jsBytesWritten bytes JS ' |
163 + 'in ${relativize(cwd, out)}'); | 163 'in ${relativize(cwd, out)}'); |
164 if (!explicitOut) { | 164 if (!explicitOut) { |
165 String input = uriPathToNative(arguments[0]); | 165 String input = uriPathToNative(arguments[0]); |
166 String output = relativize(cwd, out); | 166 String output = relativize(cwd, out); |
167 print('Dart file $input compiled to JavaScript: $output'); | 167 print('Dart file $input compiled to JavaScript: $output'); |
168 } | 168 } |
169 } | 169 } |
170 | 170 |
171 class AbortLeg { | 171 class AbortLeg { |
172 final message; | 172 final message; |
173 AbortLeg(this.message); | 173 AbortLeg(this.message); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 } catch (var ignored) { | 281 } catch (var ignored) { |
282 print('Internal error: error while printing exception'); | 282 print('Internal error: error while printing exception'); |
283 } | 283 } |
284 try { | 284 try { |
285 print(trace); | 285 print(trace); |
286 } finally { | 286 } finally { |
287 exit(253); // 253 is recognized as a crash by our test scripts. | 287 exit(253); // 253 is recognized as a crash by our test scripts. |
288 } | 288 } |
289 } | 289 } |
290 } | 290 } |
OLD | NEW |