OLD | NEW |
---|---|
1 {% extends 'interface_base_cpp.template' %} | 1 {% extends 'interface_base_cpp.template' %} |
2 | 2 |
3 | 3 |
4 {# TODO(terry): Implement setter and deleter too #} | 4 {# TODO(terry): Implement setter and deleter too #} |
5 | 5 |
6 | 6 |
7 {##############################################################################} | 7 {##############################################################################} |
8 {% block named_property_getter %} | |
9 {% if named_property_getter and not named_property_getter.is_custom %} | |
10 static void namedPropertyGetter(Dart_NativeArguments args) | |
11 { | |
12 {{cpp_class}}* /* FIXME(vsm): Remove this. */ ALLOW_UNUSED receiver = GetRec eiver<{{cpp_class}}>(args); | |
esprehn
2015/02/19 20:12:48
copy pasta for what?
abarth-chromium
2015/02/19 20:19:57
We need to clean up these templates. For this CL,
| |
13 Dart_Handle exception = nullptr; | |
14 { | |
15 {% if named_property_getter.is_raises_exception %} | |
16 ExceptionState es; | |
17 {% endif %} | |
18 | |
19 String name = DartConverter<String>::FromArguments(args, 1, exception); | |
20 if (exception) | |
21 goto fail; | |
22 {{named_property_getter.cpp_type}} result = {{named_property_getter.cpp_ value}}; | |
23 if (!result) | |
24 return; | |
25 {{named_property_getter.dart_set_return_value}}; | |
26 return; | |
27 } | |
28 | |
29 fail: | |
30 Dart_ThrowException(exception); | |
31 ASSERT_NOT_REACHED(); | |
32 } | |
33 | |
34 {% endif %} | |
35 {% endblock %} | |
36 | |
37 {##############################################################################} | |
38 {% block named_property_setter %} | |
39 {% if named_property_setter and not named_property_setter.is_custom %} | |
40 static void namedPropertySetter(Dart_NativeArguments args) | |
41 { | |
42 {{cpp_class}}* /* FIXME(vsm): Remove this. */ ALLOW_UNUSED receiver = GetRec eiver<{{cpp_class}}>(args); | |
43 Dart_Handle exception = nullptr; | |
44 { | |
45 {% if named_property_setter.is_raises_exception %} | |
46 ExceptionState es; | |
esprehn
2015/02/19 20:12:48
Nothing seems to use this? The Dart_Handle excepti
abarth-chromium
2015/02/19 20:19:57
It is used by {{named_property_setter.cpp_value}}
| |
47 {% endif %} | |
48 | |
49 String name = DartConverter<String>::FromArguments(args, 1, exception); | |
50 if (exception) | |
51 goto fail; | |
52 String value = DartConverter<String>::FromArguments(args, 2, exception); | |
53 if (exception) | |
54 goto fail; | |
55 {{named_property_setter.cpp_value}}; | |
56 return; | |
57 } | |
58 | |
59 fail: | |
60 Dart_ThrowException(exception); | |
61 ASSERT_NOT_REACHED(); | |
62 } | |
63 | |
64 {% endif %} | |
65 {% endblock %} | |
66 | |
67 {##############################################################################} | |
8 {% block indexed_property_getter %} | 68 {% block indexed_property_getter %} |
9 {% if indexed_property_getter and not indexed_property_getter.is_custom %} | 69 {% if indexed_property_getter and not indexed_property_getter.is_custom %} |
10 {% set getter = indexed_property_getter %} | 70 {% set getter = indexed_property_getter %} |
11 static void indexedPropertyGetter(Dart_NativeArguments args) | 71 static void indexedPropertyGetter(Dart_NativeArguments args) |
12 { | 72 { |
13 {{cpp_class}}* /* FIXME(vsm): Remove this. */ ALLOW_UNUSED receiver = GetRec eiver<{{cpp_class}}>(args); | 73 {{cpp_class}}* /* FIXME(vsm): Remove this. */ ALLOW_UNUSED receiver = GetRec eiver<{{cpp_class}}>(args); |
14 Dart_Handle exception = nullptr; | 74 Dart_Handle exception = nullptr; |
15 { | 75 { |
16 {% if indexed_property_getter.is_raises_exception %} | 76 {% if indexed_property_getter.is_raises_exception %} |
17 ExceptionState es; | 77 ExceptionState es; |
(...skipping 13 matching lines...) Expand all Loading... | |
31 | 91 |
32 fail: | 92 fail: |
33 Dart_ThrowException(exception); | 93 Dart_ThrowException(exception); |
34 ASSERT_NOT_REACHED(); | 94 ASSERT_NOT_REACHED(); |
35 } | 95 } |
36 | 96 |
37 {% endif %} | 97 {% endif %} |
38 {# TODO(terry): Should handle custom index getter - none today. #} | 98 {# TODO(terry): Should handle custom index getter - none today. #} |
39 {% endblock %} | 99 {% endblock %} |
40 | 100 |
41 | |
42 {##############################################################################} | 101 {##############################################################################} |
43 {% block indexed_property_getter_resolver %} | 102 {% block indexed_property_getter_resolver %} |
44 {# TODO(terry): Support all indexed and named properties today only indexed getter is supported. #} | 103 {# TODO(terry): Support all indexed and named properties today only indexed getter is supported. #} |
45 {# Resolver indexed properties #} | 104 {# Resolver indexed properties #} |
46 {% if indexed_property_getter and not indexed_property_getter.is_custom %} | 105 {% if indexed_property_getter and not indexed_property_getter.is_custom %} |
47 {% for native_entry in indexed_property_getter.native_entries %} | 106 {% for native_entry in indexed_property_getter.native_entries %} |
48 {% set resolver_string = native_entry.resolver_string %} | 107 {% set resolver_string = native_entry.resolver_string %} |
49 if (argumentCount == 2 && name == "{{resolver_string}}") { | 108 if (argumentCount == 2 && name == "{{resolver_string}}") { |
50 *autoSetupScope = true; | 109 *autoSetupScope = true; |
51 return {{dart_class}}Internal::indexedPropertyGetter; | 110 return {{dart_class}}Internal::indexedPropertyGetter; |
52 } | 111 } |
53 {% endfor %} | 112 {% endfor %} |
54 {% endif %} | 113 {% endif %} |
55 {% endblock %} | 114 {% endblock %} |
56 | 115 |
57 {##############################################################################} | 116 {##############################################################################} |
58 {% block named_property_getter_resolver %} | 117 {% block named_property_getter_resolver %} |
59 {# Resolver named properties #} | 118 {# Resolver named properties #} |
60 {% if named_property_getter %} | 119 {% if named_property_getter and not named_property_getter.is_custom %} |
61 {% for native_entry in named_property_getter.native_entries %} | 120 {% for native_entry in named_property_getter.native_entries %} |
62 {% set resolver_string = native_entry.resolver_string %} | 121 {% set resolver_string = native_entry.resolver_string %} |
63 if (argumentCount == 2 && (name == "{{resolver_string}}")) { | 122 if (argumentCount == 2 && (name == "{{resolver_string}}")) { |
64 *autoSetupScope = true; | 123 *autoSetupScope = true; |
65 return {{dart_class}}Internal::propertyQuery; | 124 return {{dart_class}}Internal::namedPropertyGetter; |
66 } | 125 } |
67 {% endfor %} | 126 {% endfor %} |
68 {% endif %} | 127 {% endif %} |
128 {% endblock %} | |
129 | |
130 {##############################################################################} | |
131 {% block named_property_setter_resolver %} | |
132 {# Resolver named properties #} | |
133 {% if named_property_setter and not named_property_setter.is_custom %} | |
134 {% for native_entry in named_property_setter.native_entries %} | |
135 {% set resolver_string = native_entry.resolver_string %} | |
136 if (argumentCount == 3 && (name == "{{resolver_string}}")) { | |
137 *autoSetupScope = true; | |
138 return {{dart_class}}Internal::namedPropertySetter; | |
139 } | |
140 {% endfor %} | |
141 {% endif %} | |
69 {% endblock %} | 142 {% endblock %} |
70 | 143 |
71 {##############################################################################} | 144 {##############################################################################} |
72 {% block generate_symbolizer_indexed_property_getter %} | 145 {% block generate_symbolizer_indexed_property_getter %} |
73 {% if indexed_property_getter and not indexed_property_getter.is_custom %} | 146 {% if indexed_property_getter and not indexed_property_getter.is_custom %} |
74 {% for native_entry in indexed_property_getter.native_entries %} | 147 {% for native_entry in indexed_property_getter.native_entries %} |
75 {% set resolver_string = native_entry.resolver_string %} | 148 {% set resolver_string = native_entry.resolver_string %} |
76 if (native_function == {{dart_class}}Internal::indexedPropertyGetter) { | 149 if (native_function == {{dart_class}}Internal::indexedPropertyGetter) { |
77 return reinterpret_cast<const uint8_t*>("{{resolver_string}}"); | 150 return reinterpret_cast<const uint8_t*>("{{resolver_string}}"); |
78 } | 151 } |
79 {% endfor %} | 152 {% endfor %} |
80 {% endif %} | 153 {% endif %} |
81 {% endblock %} | 154 {% endblock %} |
82 | 155 |
83 {##############################################################################} | 156 {##############################################################################} |
84 {% block generate_symbolizer_named_property_getter %} | 157 {% block generate_symbolizer_named_property_getter %} |
85 {# Resolver named properties #} | |
86 {% if named_property_getter %} | 158 {% if named_property_getter %} |
87 {% for native_entry in named_property_getter.native_entries %} | 159 {% for native_entry in named_property_getter.native_entries %} |
88 {% set resolver_string = native_entry.resolver_string %} | 160 {% set resolver_string = native_entry.resolver_string %} |
89 if (native_function == {{dart_class}}Internal::propertyQuery) { | 161 if (native_function == {{dart_class}}Internal::namedPropertyGetter) { |
90 return reinterpret_cast<const uint8_t*>("{{resolver_string}}"); | 162 return reinterpret_cast<const uint8_t*>("{{resolver_string}}"); |
91 } | 163 } |
92 {% endfor %} | 164 {% endfor %} |
165 {% endif %} | |
166 {% endblock %} | |
167 | |
168 {##############################################################################} | |
169 {% block generate_symbolizer_named_property_setter %} | |
170 {% if named_property_setter %} | |
171 {% for native_entry in named_property_setter.native_entries %} | |
172 {% set resolver_string = native_entry.resolver_string %} | |
173 if (native_function == {{dart_class}}Internal::namedPropertySetter) { | |
174 return reinterpret_cast<const uint8_t*>("{{resolver_string}}"); | |
175 } | |
176 {% endfor %} | |
93 {% endif %} | 177 {% endif %} |
94 {% endblock %} | 178 {% endblock %} |
95 | 179 |
96 {##############################################################################} | 180 {##############################################################################} |
97 | 181 |
98 {% from 'methods_cpp.template' import static_method_name with context %} | 182 {% from 'methods_cpp.template' import static_method_name with context %} |
99 | 183 |
100 {##############################################################################} | 184 {##############################################################################} |
101 {% block overloaded_constructor %} | 185 {% block overloaded_constructor %} |
102 {% if constructor_overloads %} | 186 {% if constructor_overloads %} |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 return; | 235 return; |
152 fail: | 236 fail: |
153 Dart_ThrowException(exception); | 237 Dart_ThrowException(exception); |
154 ASSERT_NOT_REACHED(); | 238 ASSERT_NOT_REACHED(); |
155 } | 239 } |
156 {% endif %} | 240 {% endif %} |
157 {% endblock %} | 241 {% endblock %} |
158 | 242 |
159 | 243 |
160 {##############################################################################} | 244 {##############################################################################} |
OLD | NEW |