Chromium Code Reviews| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 info('compiling $uri'); | 235 info('compiling $uri'); |
| 236 info('package root is $packageRoot'); | 236 info('package root is $packageRoot'); |
| 237 | 237 |
| 238 // TODO(ahe): We expect the future to be complete and call value | 238 // TODO(ahe): We expect the future to be complete and call value |
| 239 // directly. In effect, we don't support truly asynchronous API. | 239 // directly. In effect, we don't support truly asynchronous API. |
| 240 String code = api.compile(uri, libraryRoot, packageRoot, provider, handler, | 240 String code = api.compile(uri, libraryRoot, packageRoot, provider, handler, |
| 241 options).value; | 241 options).value; |
| 242 if (code === null) { | 242 if (code === null) { |
| 243 fail('Error: Compilation failed.'); | 243 fail('Error: Compilation failed.'); |
| 244 } | 244 } |
| 245 code = '$code\n//@ sourceMappingURL=${relativize(out, sourceMapOut)}'; | |
|
ahe
2012/08/02 20:34:56
Doesn't this mean that we ignore source maps?
podivilov
2012/08/21 12:29:35
I think dart2js shouldn't inject sourceMappingURL
ahe
2012/08/21 12:42:32
How do we enable source maps by default without ha
podivilov
2012/08/21 17:04:25
Should we enable them by default? One can easily a
ahe
2012/08/22 09:39:43
I think the default behavior should be to enable s
| |
| 246 writeString(out, code); | 245 writeString(out, code); |
| 247 int jsBytesWritten = code.length; | 246 int jsBytesWritten = code.length; |
| 248 info('compiled $dartBytesRead bytes Dart -> $jsBytesWritten bytes JS ' | 247 info('compiled $dartBytesRead bytes Dart -> $jsBytesWritten bytes JS ' |
| 249 'in ${relativize(cwd, out)}'); | 248 'in ${relativize(cwd, out)}'); |
| 250 if (!explicitOut) { | 249 if (!explicitOut) { |
| 251 String input = uriPathToNative(arguments[0]); | 250 String input = uriPathToNative(arguments[0]); |
| 252 String output = relativize(cwd, out); | 251 String output = relativize(cwd, out); |
| 253 print('Dart file $input compiled to JavaScript: $output'); | 252 print('Dart file $input compiled to JavaScript: $output'); |
| 254 } | 253 } |
| 255 } | 254 } |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 } catch (var ignored) { | 373 } catch (var ignored) { |
| 375 print('Internal error: error while printing exception'); | 374 print('Internal error: error while printing exception'); |
| 376 } | 375 } |
| 377 try { | 376 try { |
| 378 print(trace); | 377 print(trace); |
| 379 } finally { | 378 } finally { |
| 380 exit(253); // 253 is recognized as a crash by our test scripts. | 379 exit(253); // 253 is recognized as a crash by our test scripts. |
| 381 } | 380 } |
| 382 } | 381 } |
| 383 } | 382 } |
| OLD | NEW |