| OLD | NEW |
| 1 Sky Module System | 1 Sky Module System |
| 2 ================= | 2 ================= |
| 3 | 3 |
| 4 This document describes the Sky module system. | 4 This document describes the Sky module system. |
| 5 | 5 |
| 6 Overview | 6 Overview |
| 7 -------- | 7 -------- |
| 8 | 8 |
| 9 The Sky module system is based on the ``import`` element. In its | 9 The Sky module system is based on the ``import`` element. In its |
| 10 most basic form, you import a module as follows: | 10 most basic form, you import a module as follows: |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 appended (but without affecting the library's list of declarations and | 59 appended (but without affecting the library's list of declarations and |
| 60 without any possibility of it clashing with identifiers described in | 60 without any possibility of it clashing with identifiers described in |
| 61 the library itself): | 61 the library itself): |
| 62 | 62 |
| 63 ```dart | 63 ```dart |
| 64 class _ { } | 64 class _ { } |
| 65 void main() { | 65 void main() { |
| 66 LibraryMirror library = reflectClass(_).owner as LibraryMirror; | 66 LibraryMirror library = reflectClass(_).owner as LibraryMirror; |
| 67 if (library.declarations.containsKey(#init) && library.declarations[#init] is
MethodMirror) | 67 if (library.declarations.containsKey(#init) && library.declarations[#init] is
MethodMirror) |
| 68 init(); | 68 init(); |
| 69 module.init(library); | 69 AutomaticMetadata.runLibrary(library, module); |
| 70 } | 70 } |
| 71 ``` | 71 ``` |
| 72 | 72 |
| 73 Then, that ``main()`` function is called. | 73 Then, that ``main()`` function is called. |
| 74 | 74 |
| 75 TODO(ianh): decide what URL and name we should give the libraries, as | 75 TODO(ianh): decide what URL and name we should give the libraries, as |
| 76 exposed in MirrorSystem.getName(libraryMirror.qualifiedName) etc | 76 exposed in MirrorSystem.getName(libraryMirror.qualifiedName) etc |
| 77 | 77 |
| 78 The ``Module`` class is defined in ``sky:core`` as follows: | 78 The ``Module`` class is defined in ``sky:core`` as follows: |
| 79 | 79 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 Where ``name_1`` through ``name_n`` are the names bound to the | 141 Where ``name_1`` through ``name_n`` are the names bound to the |
| 142 various named imports in the script element's document, | 142 various named imports in the script element's document, |
| 143 ``source_code`` is the text content of the script element, | 143 ``source_code`` is the text content of the script element, |
| 144 ``source_module`` is the ``Module`` object of the script element's | 144 ``source_module`` is the ``Module`` object of the script element's |
| 145 module, and ``value_1`` through ``value_n`` are the values | 145 module, and ``value_1`` through ``value_n`` are the values |
| 146 exported by the various named imports in the script element's | 146 exported by the various named imports in the script element's |
| 147 document. | 147 document. |
| 148 | 148 |
| 149 When an import fails to load, the ``as`` name for the import gets | 149 When an import fails to load, the ``as`` name for the import gets |
| 150 bound to ``undefined``. | 150 bound to ``undefined``. |
| OLD | NEW |