OLD | NEW |
| (Empty) |
1 {#--- Constants #} | |
2 {%- for constant in module.constants %} | |
3 var {{constant.name}} = {{constant.value|expression_to_text}}; | |
4 {%- endfor %} | |
5 | |
6 {#--- Enums #} | |
7 {%- from "enum_definition.tmpl" import enum_def %} | |
8 {%- for enum in enums %} | |
9 var {{ enum_def(enum.name, enum) }} | |
10 {%- endfor %} | |
11 | |
12 {#--- Struct definitions #} | |
13 {% for struct in structs %} | |
14 {%- include "struct_definition.tmpl" %} | |
15 {%- endfor -%} | |
16 | |
17 {#--- Interface definitions #} | |
18 {%- for interface in interfaces -%} | |
19 {%- include "interface_definition.tmpl" %} | |
20 {%- endfor %} | |
21 | |
22 var exports = {}; | |
23 {%- for constant in module.constants %} | |
24 exports.{{constant.name}} = {{constant.name}}; | |
25 {%- endfor %} | |
26 {%- for enum in enums %} | |
27 exports.{{enum.name}} = {{enum.name}}; | |
28 {%- endfor %} | |
29 {%- for struct in structs if struct.exported %} | |
30 exports.{{struct.name}} = {{struct.name}}; | |
31 {%- endfor %} | |
32 {%- for interface in interfaces %} | |
33 exports.{{interface.name}} = {{interface.name}}; | |
34 {#--- Interface Client #} | |
35 {%- if interface.client in interfaces|map(attribute='name') %} | |
36 exports.{{interface.name}}.client = {{interface.client}}; | |
37 {%- elif interface.client in imported_interfaces %} | |
38 exports.{{interface.name}}.client = {{imported_interfaces[interface.client]}}; | |
39 {%- endif %} | |
40 {%- endfor %} | |
OLD | NEW |