| Index: sky/engine/bindings/scripts/templates/interface_dart.template
|
| diff --git a/sky/engine/bindings/scripts/templates/interface_dart.template b/sky/engine/bindings/scripts/templates/interface_dart.template
|
| index 9037bd504581151760ec3669e2c5e44e2ad7204c..274760a300be6de8a44112430c0b05b7fdc23dd6 100644
|
| --- a/sky/engine/bindings/scripts/templates/interface_dart.template
|
| +++ b/sky/engine/bindings/scripts/templates/interface_dart.template
|
| @@ -5,23 +5,24 @@
|
| // WARNING: Do not edit - generated code.
|
| part of sky.core;
|
|
|
| -abstract class {{interface_name}} extends {{ parent_interface if parent_interface else 'NativeFieldWrapperClass2' }} {
|
| -
|
| {% macro args_macro(args) -%}
|
| {%- for arg in args -%}
|
| {%- if arg.is_optional and (loop.first or not args[arg.index-1].is_optional) -%}
|
| - [
|
| + {{ '{' if arg.is_named else '[' }}
|
| {%- endif -%}
|
| {{ arg.dart_type }} {{ arg.name }}
|
| {%- if arg.is_optional %} = {{ arg.dart_default_value }}
|
| - {%- if loop.last -%}]{%- endif -%}
|
| + {#- TODO(eseidel): This does not support having both optional and named arguments! -#}
|
| + {%- if loop.last -%}{{ '}' if arg.is_named else ']' }}{%- endif -%}
|
| {%- endif -%}
|
| {%- if not loop.last %}, {% endif %}
|
| {%- endfor -%}
|
| -{%- endmacro %}
|
| +{%- endmacro -%}
|
|
|
| +abstract class {{interface_name}} extends {{ parent_interface if parent_interface else 'NativeFieldWrapperClass2' }} {
|
| + // Constructors
|
| {# TODO(eseidel): We only ever have one constructor. #}
|
| -{% for constructor in constructors %}
|
| +{%- for constructor in constructors -%}
|
| static {{interface_name}} _constructor({{ args_macro(constructor.arguments) }}) native "{{interface_name}}_constructorCallback";
|
| factory {{interface_name}}({{ args_macro(constructor.arguments) }}) => _constructor(
|
| {%- for arg in constructor.arguments -%}
|
| @@ -30,6 +31,7 @@ abstract class {{interface_name}} extends {{ parent_interface if parent_interfac
|
| );
|
| {% endfor %}
|
|
|
| + // Attributes
|
| {% for attribute in attributes %}
|
| {{ attribute.dart_type }} get {{ attribute.name }} native "{{interface_name}}_{{ attribute.name }}_Getter";
|
| {% if not attribute.is_read_only %}
|
| @@ -37,7 +39,8 @@ abstract class {{interface_name}} extends {{ parent_interface if parent_interfac
|
| {% endif %}
|
| {% endfor %}
|
|
|
| + // Methods
|
| {% for method in methods %}
|
| - {{method.dart_type}} {{method.name}}({{ args_macro(method.arguments)}} ) native "{{interface_name}}_{{ method.name }}_Callback";
|
| + {{method.dart_type}} {{method.name}}({{ args_macro(method.arguments)}}) native "{{interface_name}}_{{ method.name }}_Callback";
|
| {% endfor %}
|
| }
|
|
|