Chromium Code Reviews| 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..6e0f83a93ef121b9348ede96137bc7b08ec64aa2 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 %} |
| + |
|
zra
2016/01/27 18:15:12
I wonder if newlines like this one are contributin
alexfandrianto
2016/01/28 03:45:12
This one's probably okay since it's not part of th
|
| +{%- 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,14 @@ class {{enum|name}} extends bindings.MojoEnum { |
| case {{field|name}}: |
| return '{{enum|name}}.{{field|name}}'; |
| {%- endfor %} |
| + default: |
| + return null; |
| } |
| } |
| int toJson() => mojoEnumValue; |
| } |
| + |
|
zra
2016/01/27 18:15:12
Ditto.
alexfandrianto
2016/01/28 03:45:12
This was supposed to be intentional, but it is aff
|
| +{{ mojom_type_macros.writeMojomTypeDef(enum, typepkg, package) }} |
| + |
|
zra
2016/01/27 18:15:12
Ditto.
alexfandrianto
2016/01/28 03:45:12
Done.
|
| {%- endmacro %} |