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 | 6 |
7 // NOTE: Do not import 'dart:io' in builtin. | 7 // NOTE: Do not import 'dart:io' in builtin. |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:collection'; | 9 import 'dart:collection'; |
10 import 'dart:_internal' hide Symbol; | 10 import 'dart:_internal' hide Symbol; |
11 import 'dart:isolate'; | 11 import 'dart:isolate'; |
12 import 'dart:typed_data'; | 12 import 'dart:typed_data'; |
13 | 13 |
14 // Embedder sets this to true if the --trace-loading flag was passed on the | 14 // Embedder sets this to true if the --trace-loading flag was passed on the |
15 // command line. | 15 // command line. |
16 bool _traceLoading = false; | 16 bool _traceLoading = false; |
17 | 17 |
18 // Before handling an embedder entrypoint we finalize the setup of the | 18 // Before handling an embedder entrypoint we finalize the setup of the |
19 // dart:_builtin library. | 19 // dart:_builtin library. |
20 bool _setupCompleted = false; | 20 bool _setupCompleted = false; |
21 | 21 |
22 // The root library (aka the script) is imported into this library. The | |
23 // standalone embedder uses this to lookup the main entrypoint in the | |
24 // root library's namespace. | |
25 Function _getMainClosure() => main; | |
26 | |
27 // 'print' implementation. | 22 // 'print' implementation. |
28 // The standalone embedder registers the closurized _print function with the | 23 // The standalone embedder registers the closurized _print function with the |
29 // dart:core library. | 24 // dart:core library. |
30 void _printString(String s) native "Builtin_PrintString"; | 25 void _printString(String s) native "Builtin_PrintString"; |
31 | 26 |
32 void _print(arg) { | 27 void _print(arg) { |
33 _printString(arg.toString()); | 28 _printString(arg.toString()); |
34 } | 29 } |
35 | 30 |
36 _getPrintClosure() => _print; | 31 _getPrintClosure() => _print; |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 if (_traceLoading) { | 373 if (_traceLoading) { |
379 _log("Exception when resolving package URI: $packageUri"); | 374 _log("Exception when resolving package URI: $packageUri"); |
380 } | 375 } |
381 result = null; | 376 result = null; |
382 } | 377 } |
383 if (_traceLoading) { | 378 if (_traceLoading) { |
384 _log("Resolved '$packageUri' to '$result'"); | 379 _log("Resolved '$packageUri' to '$result'"); |
385 } | 380 } |
386 return result; | 381 return result; |
387 } | 382 } |
OLD | NEW |