Index: mojo/public/tools/bindings/generators/dart_templates/enum_definition.tmpl |
diff --git a/mojo/public/tools/bindings/generators/dart_templates/enum_definition.tmpl b/mojo/public/tools/bindings/generators/dart_templates/enum_definition.tmpl |
index 753892021b4313c80e96f76a5c217d463cbd69f4..e41ca99c3cb9323d082efb636691e3b057f5834a 100644 |
--- a/mojo/public/tools/bindings/generators/dart_templates/enum_definition.tmpl |
+++ b/mojo/public/tools/bindings/generators/dart_templates/enum_definition.tmpl |
@@ -1,4 +1,6 @@ |
-{%- macro enum_def(enum) %} |
+{% import "mojom_type_macros.tmpl" as mojom_type_macros %} |
+ |
+{%- macro enum_def(enum, typepkg, package) %} |
class {{enum|name}} extends bindings.MojoEnum { |
{%- for field in enum.fields %} |
static const {{enum|name}} {{field|name}} = const {{enum|name}}._({{field.resolved_value}}); |
@@ -46,9 +48,15 @@ class {{enum|name}} extends bindings.MojoEnum { |
case {{field|name}}: |
return '{{enum|name}}.{{field|name}}'; |
{%- endfor %} |
+ default: |
+ return null; |
} |
} |
int toJson() => mojoEnumValue; |
} |
+ |
+{% if should_gen_mojom_types -%} |
+{{ mojom_type_macros.writeMojomTypeDef(enum, typepkg, package) }} |
+{%- endif -%} |
{%- endmacro %} |