blob: b22a7f3e6496d4d9b67d657e44fd2eb1447e7615 [file]
{#--- Constants #}
{%- for constant in module.constants %}
const {{constant.kind|dart_type}} {{constant|name}} = {{constant.resolved_value}};
{%- endfor %}
{#--- Enums #}
{%- from "enum_definition.tmpl" import enum_def %}
{%- for enum in enums %}
{{ enum_def(enum, typepkg, package) }}
{%- endfor %}
{#--- Struct definitions #}
{%- from "struct_definition.tmpl" import struct_def %}
{% for struct in structs %}
{{ struct_def(struct, typepkg, package) }}
{%- endfor -%}
{#--- Union definitions #}
{%- from "union_definition.tmpl" import union_def %}
{% for union in unions %}
{{ union_def(union, typepkg, package) }}
{%- endfor -%}
{#--- Interface definitions #}
{%- for interface in interfaces -%}
{%- include "interface_definition.tmpl" %}
{%- endfor %}
{% if should_gen_mojom_types -%}
{{typepkg}}RuntimeTypeInfo getRuntimeTypeInfo() => _runtimeTypeInfo ??
_initRuntimeTypeInfo();
Map<String, {{typepkg}}UserDefinedType> getAllMojomTypeDefinitions() {
return getRuntimeTypeInfo().typeMap;
}
var _runtimeTypeInfo;
{{typepkg}}RuntimeTypeInfo _initRuntimeTypeInfo() {
// serializedRuntimeTypeInfo contains the bytes of the Mojo serialization of
// a mojom_types.RuntimeTypeInfo struct describing the Mojom types in this
// file.
var serializedRuntimeTypeInfo = new Uint8List.fromList(const [{{serialized_runtime_type_info_literal}}]);
// Deserialize RuntimeTypeInfo
var bdata = new ByteData.view(serializedRuntimeTypeInfo.buffer);
var message = new bindings.Message(bdata, null, serializedRuntimeTypeInfo.length, 0);
_runtimeTypeInfo = {{typepkg}}RuntimeTypeInfo.deserialize(message);
return _runtimeTypeInfo;
}
{%- endif %}