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 {% macro args_macro(args) -%} | 8 {% macro args_macro(args) -%} |
9 {%- for arg in args -%} | 9 {%- for arg in args -%} |
10 {%- 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) -%} |
11 {{ '{' if arg.is_named else '[' }} | 11 {{ '{' if arg.is_named else '[' }} |
12 {%- endif -%} | 12 {%- endif -%} |
13 {{ arg.dart_type }} {{ arg.name }} | 13 {{ arg.dart_type }} {{ arg.name }} |
14 {%- if arg.is_optional %} {{ ':' if arg.is_named else '='}} {{ arg.dart
_default_value }} | 14 {%- if arg.is_optional %} {{ ':' if arg.is_named else '='}} {{ arg.dart_
default_value }} |
15 {#- TODO(eseidel): This does not support having both optional and named
arguments! -#} | 15 {#- TODO(eseidel): This does not support having both optional and named
arguments! -#} |
16 {%- if loop.last -%}{{ '}' if arg.is_named else ']' }}{%- endif -%} | 16 {%- if loop.last -%}{{ '}' if arg.is_named else ']' }}{%- endif -%} |
17 {%- endif -%} | 17 {%- endif -%} |
18 {%- if not loop.last %}, {% endif %} | 18 {%- if not loop.last %}, {% endif %} |
19 {%- endfor -%} | 19 {%- endfor -%} |
20 {%- endmacro -%} | 20 {%- endmacro -%} |
21 | 21 |
22 {% if not constructors %}abstract {% endif -%} | 22 {% if not constructors %}abstract {% endif -%} |
23 class {{interface_name}} extends {{ parent_interface if parent_interface else 'N
ativeFieldWrapperClass2' }} { | 23 class {{interface_name}} extends {{ parent_interface if parent_interface else 'N
ativeFieldWrapperClass2' }} { |
24 // Constructors | 24 // Constructors |
25 {# TODO(eseidel): We only ever have one constructor. #} | 25 {# TODO(eseidel): We only ever have one constructor. #} |
26 {%- for constructor in constructors %} | 26 {%- for constructor in constructors %} |
27 void _constructor({{ args_macro(constructor.arguments) }}) native "{{interfa
ce_name}}_constructorCallback"; | 27 void _constructor( |
| 28 {%- for arg in constructor.arguments -%} |
| 29 {{ arg.dart_type }} {{ arg.name }}{% if not loop.last %}, {% endif %} |
| 30 {%- endfor -%} |
| 31 ) native "{{interface_name}}_constructorCallback"; |
28 {{interface_name}}({{ args_macro(constructor.arguments) }}) { _constructor( | 32 {{interface_name}}({{ args_macro(constructor.arguments) }}) { _constructor( |
29 {%- for arg in constructor.arguments -%} | 33 {%- for arg in constructor.arguments -%} |
30 {{ arg.name }}{% if not loop.last %}, {% endif %} | 34 {{ arg.name }}{% if not loop.last %}, {% endif %} |
31 {%- endfor -%} | 35 {%- endfor -%} |
32 ); } | 36 ); } |
33 {% endfor %} | 37 {% endfor %} |
34 | 38 |
35 // Attributes | 39 // Attributes |
36 {% for attribute in attributes %} | 40 {% for attribute in attributes %} |
37 {{ attribute.dart_type }} get {{ attribute.name }} native "{{interface_name}
}_{{ attribute.name }}_Getter"; | 41 {{ attribute.dart_type }} get {{ attribute.name }} native "{{interface_name}
}_{{ attribute.name }}_Getter"; |
38 {% if not attribute.is_read_only %} | 42 {% if not attribute.is_read_only %} |
39 void set {{ attribute.name }}({{ attribute.dart_type }} value) native "{{int
erface_name}}_{{ attribute.name }}_Setter"; | 43 void set {{ attribute.name }}({{ attribute.dart_type }} value) native "{{int
erface_name}}_{{ attribute.name }}_Setter"; |
40 {% endif %} | 44 {% endif %} |
41 {% endfor %} | 45 {% endfor %} |
42 | 46 |
43 // Methods | 47 // Methods |
44 {% for method in methods %} | 48 {% for method in methods %} |
45 {{method.dart_type}} {{method.name}}({{ args_macro(method.arguments)}}) nati
ve "{{interface_name}}_{{ method.name }}_Callback"; | 49 {{method.dart_type}} {{method.name}}({{ args_macro(method.arguments)}}) nati
ve "{{interface_name}}_{{ method.name }}_Callback"; |
46 {% endfor %} | 50 {% endfor %} |
47 | 51 |
48 // Operators | 52 // Operators |
49 {% if named_property_getter %} | 53 {% if named_property_getter %} |
50 String operator[](String name) native "{{interface_name}}___getter___Callbac
k"; | 54 String operator[](String name) native "{{interface_name}}___getter___Callbac
k"; |
51 {% endif %} | 55 {% endif %} |
52 {% if named_property_setter %} | 56 {% if named_property_setter %} |
53 void operator[]=(String name, String value) native "{{interface_name}}___set
ter___Callback"; | 57 void operator[]=(String name, String value) native "{{interface_name}}___set
ter___Callback"; |
54 {% endif %} | 58 {% endif %} |
55 } | 59 } |
OLD | NEW |