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 wrapping binding from the IDL database.""" | 7 wrapping binding from the IDL database.""" |
8 | 8 |
9 import os | 9 import os |
10 from generator import * | 10 from generator import * |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 NAME=attr.id, TYPE=DartType(attr.type.id), METHOD=method_name) | 183 NAME=attr.id, TYPE=DartType(attr.type.id), METHOD=method_name) |
184 | 184 |
185 def AddSecondaryAttribute(self, interface, getter, setter): | 185 def AddSecondaryAttribute(self, interface, getter, setter): |
186 self._SecondaryContext(interface) | 186 self._SecondaryContext(interface) |
187 self.AddAttribute(getter, setter) | 187 self.AddAttribute(getter, setter) |
188 | 188 |
189 def AddSecondaryOperation(self, interface, info): | 189 def AddSecondaryOperation(self, interface, info): |
190 self._SecondaryContext(interface) | 190 self._SecondaryContext(interface) |
191 self.AddOperation(info) | 191 self.AddOperation(info) |
192 | 192 |
193 def AddEventAttributes(self, event_attrs): | |
194 pass | |
195 | |
196 def _SecondaryContext(self, interface): | 193 def _SecondaryContext(self, interface): |
197 if interface is not self._current_secondary_parent: | 194 if interface is not self._current_secondary_parent: |
198 self._current_secondary_parent = interface | 195 self._current_secondary_parent = interface |
199 self._members_emitter.Emit('\n // From $WHERE\n', WHERE=interface.id) | 196 self._members_emitter.Emit('\n // From $WHERE\n', WHERE=interface.id) |
200 | 197 |
201 def AddIndexer(self, element_type): | 198 def AddIndexer(self, element_type): |
202 """Adds all the methods required to complete implementation of List.""" | 199 """Adds all the methods required to complete implementation of List.""" |
203 # We would like to simply inherit the implementation of everything except | 200 # We would like to simply inherit the implementation of everything except |
204 # get length(), [], and maybe []=. It is possible to extend from a base | 201 # get length(), [], and maybe []=. It is possible to extend from a base |
205 # array implementation class only when there is no other implementation | 202 # array implementation class only when there is no other implementation |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 # dispatch has removed f(X), leaving only f(Y), but there is no guarantee | 530 # dispatch has removed f(X), leaving only f(Y), but there is no guarantee |
534 # that Y = Z-X, so we need to check for Y. | 531 # that Y = Z-X, so we need to check for Y. |
535 true_code = emitter.Emit( | 532 true_code = emitter.Emit( |
536 '$(INDENT)if ($COND) {\n' | 533 '$(INDENT)if ($COND) {\n' |
537 '$!TRUE' | 534 '$!TRUE' |
538 '$(INDENT)}\n', | 535 '$(INDENT)}\n', |
539 COND=test, INDENT=indent) | 536 COND=test, INDENT=indent) |
540 self.GenerateDispatch( | 537 self.GenerateDispatch( |
541 true_code, info, indent + ' ', position + 1, positive) | 538 true_code, info, indent + ' ', position + 1, positive) |
542 return True | 539 return True |
OLD | NEW |