| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
| 4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 """This module provides shared functionality for the systems to generate | 6 """This module provides shared functionality for the systems to generate |
| 7 frog binding from the IDL database.""" | 7 frog binding from the IDL database.""" |
| 8 | 8 |
| 9 import os | 9 import os |
| 10 from generator import * | 10 from generator import * |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 self._members_emitter.Emit('\n static final $TYPE $NAME = $VALUE;\n', | 188 self._members_emitter.Emit('\n static final $TYPE $NAME = $VALUE;\n', |
| 189 NAME=constant.id, | 189 NAME=constant.id, |
| 190 TYPE=DartType(constant.type.id), | 190 TYPE=DartType(constant.type.id), |
| 191 VALUE=constant.value) | 191 VALUE=constant.value) |
| 192 | 192 |
| 193 pass | 193 pass |
| 194 | 194 |
| 195 def OverrideMember(self, member): | 195 def OverrideMember(self, member): |
| 196 return self._interface.id + '.' + member in _dom_frog_omitted_members | 196 return self._interface.id + '.' + member in _dom_frog_omitted_members |
| 197 | 197 |
| 198 def AddAttribute(self, getter, setter): | 198 def AddAttribute(self, attribute): |
| 199 getter = attribute |
| 200 setter = attribute if not IsReadOnly(attribute) else None |
| 199 if getter and self.OverrideMember('get:' + getter.id): | 201 if getter and self.OverrideMember('get:' + getter.id): |
| 200 getter = None | 202 getter = None |
| 201 if setter and self.OverrideMember('set:' + setter.id): | 203 if setter and self.OverrideMember('set:' + setter.id): |
| 202 setter = None | 204 setter = None |
| 203 if not getter and not setter: | 205 if not getter and not setter: |
| 204 return | 206 return |
| 205 | 207 |
| 206 output_type = getter and self._NarrowOutputType(getter.type.id) | 208 output_type = getter and self._NarrowOutputType(getter.type.id) |
| 207 input_type = setter and self._NarrowInputType(setter.type.id) | 209 input_type = setter and self._NarrowInputType(setter.type.id) |
| 208 | 210 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 if attr2: | 307 if attr2: |
| 306 return (attr2, parent_interface_name) | 308 return (attr2, parent_interface_name) |
| 307 | 309 |
| 308 return FindInParent( | 310 return FindInParent( |
| 309 self._system._database.GetInterface(parent_interface_name)) | 311 self._system._database.GetInterface(parent_interface_name)) |
| 310 return (None, None) | 312 return (None, None) |
| 311 | 313 |
| 312 return FindInParent(self._interface) if attr else (None, None) | 314 return FindInParent(self._interface) if attr else (None, None) |
| 313 | 315 |
| 314 | 316 |
| 315 def AddSecondaryAttribute(self, interface, getter, setter): | 317 def AddSecondaryAttribute(self, interface, attribute): |
| 316 self._SecondaryContext(interface) | 318 self._SecondaryContext(interface) |
| 317 self.AddAttribute(getter, setter) | 319 self.AddAttribute(attribute) |
| 318 | 320 |
| 319 def AddSecondaryOperation(self, interface, info): | 321 def AddSecondaryOperation(self, interface, info): |
| 320 self._SecondaryContext(interface) | 322 self._SecondaryContext(interface) |
| 321 self.AddOperation(info) | 323 self.AddOperation(info) |
| 322 | 324 |
| 323 def _SecondaryContext(self, interface): | 325 def _SecondaryContext(self, interface): |
| 324 if interface is not self._current_secondary_parent: | 326 if interface is not self._current_secondary_parent: |
| 325 self._current_secondary_parent = interface | 327 self._current_secondary_parent = interface |
| 326 self._members_emitter.Emit('\n // From $WHERE\n', WHERE=interface.id) | 328 self._members_emitter.Emit('\n // From $WHERE\n', WHERE=interface.id) |
| 327 | 329 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 if native_body: | 388 if native_body: |
| 387 native_string = " '''" + native_body + "'''" | 389 native_string = " '''" + native_body + "'''" |
| 388 | 390 |
| 389 self._members_emitter.Emit( | 391 self._members_emitter.Emit( |
| 390 '\n' | 392 '\n' |
| 391 ' $TYPE $NAME($PARAMS) native$NATIVESTRING;\n', | 393 ' $TYPE $NAME($PARAMS) native$NATIVESTRING;\n', |
| 392 TYPE=self._NarrowOutputType(info.type_name), | 394 TYPE=self._NarrowOutputType(info.type_name), |
| 393 NAME=info.name, | 395 NAME=info.name, |
| 394 PARAMS=params, | 396 PARAMS=params, |
| 395 NATIVESTRING=native_string) | 397 NATIVESTRING=native_string) |
| OLD | NEW |