| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // WARNING: Do not edit - generated code. | 5 // WARNING: Do not edit - generated code. |
| 6 part of sky.core; | 6 part of sky.core; |
| 7 | 7 |
| 8 abstract class {{interface_name}} extends {{ parent_interface if parent_interfac
e else 'NativeFieldWrapperClass2' }} { | |
| 9 | |
| 10 {% macro args_macro(args) -%} | 8 {% macro args_macro(args) -%} |
| 11 {%- for arg in args -%} | 9 {%- for arg in args -%} |
| 12 {%- if arg.is_optional and (loop.first or not args[arg.index-1].is_optio
nal) -%} | 10 {%- if arg.is_optional and (loop.first or not args[arg.index-1].is_optio
nal) -%} |
| 13 [ | 11 {{ '{' if arg.is_named else '[' }} |
| 14 {%- endif -%} | 12 {%- endif -%} |
| 15 {{ arg.dart_type }} {{ arg.name }} | 13 {{ arg.dart_type }} {{ arg.name }} |
| 16 {%- if arg.is_optional %} = {{ arg.dart_default_value }} | 14 {%- if arg.is_optional %} = {{ arg.dart_default_value }} |
| 17 {%- if loop.last -%}]{%- endif -%} | 15 {#- TODO(eseidel): This does not support having both optional and named
arguments! -#} |
| 16 {%- if loop.last -%}{{ '}' if arg.is_named else ']' }}{%- endif -%} |
| 18 {%- endif -%} | 17 {%- endif -%} |
| 19 {%- if not loop.last %}, {% endif %} | 18 {%- if not loop.last %}, {% endif %} |
| 20 {%- endfor -%} | 19 {%- endfor -%} |
| 21 {%- endmacro %} | 20 {%- endmacro -%} |
| 22 | 21 |
| 22 abstract class {{interface_name}} extends {{ parent_interface if parent_interfac
e else 'NativeFieldWrapperClass2' }} { |
| 23 // Constructors |
| 23 {# TODO(eseidel): We only ever have one constructor. #} | 24 {# TODO(eseidel): We only ever have one constructor. #} |
| 24 {% for constructor in constructors %} | 25 {%- for constructor in constructors -%} |
| 25 static {{interface_name}} _constructor({{ args_macro(constructor.arguments)
}}) native "{{interface_name}}_constructorCallback"; | 26 static {{interface_name}} _constructor({{ args_macro(constructor.arguments)
}}) native "{{interface_name}}_constructorCallback"; |
| 26 factory {{interface_name}}({{ args_macro(constructor.arguments) }}) => _cons
tructor( | 27 factory {{interface_name}}({{ args_macro(constructor.arguments) }}) => _cons
tructor( |
| 27 {%- for arg in constructor.arguments -%} | 28 {%- for arg in constructor.arguments -%} |
| 28 {{ arg.name }}{% if not loop.last %}, {% endif %} | 29 {{ arg.name }}{% if not loop.last %}, {% endif %} |
| 29 {%- endfor -%} | 30 {%- endfor -%} |
| 30 ); | 31 ); |
| 31 {% endfor %} | 32 {% endfor %} |
| 32 | 33 |
| 34 // Attributes |
| 33 {% for attribute in attributes %} | 35 {% for attribute in attributes %} |
| 34 {{ attribute.dart_type }} get {{ attribute.name }} native "{{interface_name}
}_{{ attribute.name }}_Getter"; | 36 {{ attribute.dart_type }} get {{ attribute.name }} native "{{interface_name}
}_{{ attribute.name }}_Getter"; |
| 35 {% if not attribute.is_read_only %} | 37 {% if not attribute.is_read_only %} |
| 36 void set {{ attribute.name }}({{ attribute.dart_type }} value) native "{{int
erface_name}}_{{ attribute.name }}_Setter"; | 38 void set {{ attribute.name }}({{ attribute.dart_type }} value) native "{{int
erface_name}}_{{ attribute.name }}_Setter"; |
| 37 {% endif %} | 39 {% endif %} |
| 38 {% endfor %} | 40 {% endfor %} |
| 39 | 41 |
| 42 // Methods |
| 40 {% for method in methods %} | 43 {% for method in methods %} |
| 41 {{method.dart_type}} {{method.name}}({{ args_macro(method.arguments)}} ) nat
ive "{{interface_name}}_{{ method.name }}_Callback"; | 44 {{method.dart_type}} {{method.name}}({{ args_macro(method.arguments)}}) nati
ve "{{interface_name}}_{{ method.name }}_Callback"; |
| 42 {% endfor %} | 45 {% endfor %} |
| 43 } | 46 } |
| OLD | NEW |