| 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 builtin; | 5 library builtin; |
| 6 import 'dart:io'; | 6 import 'dart:io'; |
| 7 import 'dart:async'; |
| 7 // import 'root_library'; happens here from C Code | 8 // import 'root_library'; happens here from C Code |
| 8 | 9 |
| 9 // The root library (aka the script) is imported into this library. The | 10 // The root library (aka the script) is imported into this library. The |
| 10 // standalone embedder uses this to lookup the main entrypoint in the | 11 // standalone embedder uses this to lookup the main entrypoint in the |
| 11 // root library's namespace. | 12 // root library's namespace. |
| 12 Function _getMainClosure() => main; | 13 Function _getMainClosure() => main; |
| 13 | 14 |
| 14 | 15 |
| 15 // Corelib 'print' implementation. | 16 // Corelib 'print' implementation. |
| 16 void _print(arg) { | 17 void _print(arg) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 .fold(new BytesBuilder(), (b, d) => b..add(d)) | 85 .fold(new BytesBuilder(), (b, d) => b..add(d)) |
| 85 .then((builder) { | 86 .then((builder) { |
| 86 _requestCompleted(builder.takeBytes(), response); | 87 _requestCompleted(builder.takeBytes(), response); |
| 87 }); | 88 }); |
| 88 }).catchError((error) { | 89 }).catchError((error) { |
| 89 _requestFailed(error); | 90 _requestFailed(error); |
| 90 }); | 91 }); |
| 91 } catch (error) { | 92 } catch (error) { |
| 92 _requestFailed(error); | 93 _requestFailed(error); |
| 93 } | 94 } |
| 95 // TODO(floitsch): remove this line. It's just here to push an event on the |
| 96 // event loop so that we invoke the scheduled microtasks. Also remove the |
| 97 // import of dart:async when this line is not needed anymore. |
| 98 Timer.run(() {}); |
| 94 } | 99 } |
| 95 | 100 |
| 96 | 101 |
| 97 // Are we running on Windows? | 102 // Are we running on Windows? |
| 98 var _isWindows = false; | 103 var _isWindows = false; |
| 99 var _workingWindowsDrivePrefix; | 104 var _workingWindowsDrivePrefix; |
| 100 // The current working directory | 105 // The current working directory |
| 101 var _workingDirectoryUri; | 106 var _workingDirectoryUri; |
| 102 // The URI that the entry point script was loaded from. Remembered so that | 107 // The URI that the entry point script was loaded from. Remembered so that |
| 103 // package imports can be resolved relative to it. | 108 // package imports can be resolved relative to it. |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 | 267 |
| 263 throw "URIs using the 'package:' scheme should look like " | 268 throw "URIs using the 'package:' scheme should look like " |
| 264 "'$right', not '$wrong'."; | 269 "'$right', not '$wrong'."; |
| 265 } | 270 } |
| 266 | 271 |
| 267 var packageRoot = _packageRoot == null ? | 272 var packageRoot = _packageRoot == null ? |
| 268 _entryPointScript.resolve('packages/') : | 273 _entryPointScript.resolve('packages/') : |
| 269 _packageRoot; | 274 _packageRoot; |
| 270 return _filePathFromUri(packageRoot.resolve(uri.path).toString()); | 275 return _filePathFromUri(packageRoot.resolve(uri.path).toString()); |
| 271 } | 276 } |
| OLD | NEW |