| 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 generates Dart APIs from the IDL database.""" | 6 """This module generates Dart APIs from the IDL database.""" |
| 7 | 7 |
| 8 import emitter | 8 import emitter |
| 9 import idlnode | 9 import idlnode |
| 10 import logging | 10 import logging |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 generator.AddConstant(const) | 389 generator.AddConstant(const) |
| 390 | 390 |
| 391 attributes = [attr for attr in interface.attributes | 391 attributes = [attr for attr in interface.attributes |
| 392 if attr.type.id != 'EventListener'] | 392 if attr.type.id != 'EventListener'] |
| 393 for (getter, setter) in _PairUpAttributes(attributes): | 393 for (getter, setter) in _PairUpAttributes(attributes): |
| 394 for generator in generators: | 394 for generator in generators: |
| 395 generator.AddAttribute(getter, setter) | 395 generator.AddAttribute(getter, setter) |
| 396 | 396 |
| 397 # The implementation should define an indexer if the interface directly | 397 # The implementation should define an indexer if the interface directly |
| 398 # extends List. | 398 # extends List. |
| 399 element_type = MaybeListElementType(interface) | 399 (element_type, requires_indexer) = ListImplementationInfo( |
| 400 interface, self._database) |
| 400 if element_type: | 401 if element_type: |
| 401 for generator in generators: | 402 for generator in generators: |
| 402 generator.AddIndexer(element_type) | 403 if requires_indexer: |
| 404 generator.AddIndexer(element_type) |
| 405 else: |
| 406 generator.AmendIndexer(element_type) |
| 403 # Group overloaded operations by id | 407 # Group overloaded operations by id |
| 404 operationsById = {} | 408 operationsById = {} |
| 405 for operation in interface.operations: | 409 for operation in interface.operations: |
| 406 if operation.id not in operationsById: | 410 if operation.id not in operationsById: |
| 407 operationsById[operation.id] = [] | 411 operationsById[operation.id] = [] |
| 408 operationsById[operation.id].append(operation) | 412 operationsById[operation.id].append(operation) |
| 409 | 413 |
| 410 # Generate operations | 414 # Generate operations |
| 411 for id in sorted(operationsById.keys()): | 415 for id in sorted(operationsById.keys()): |
| 412 operations = operationsById[id] | 416 operations = operationsById[id] |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 | 621 |
| 618 def AddSecondaryAttribute(self, interface, getter, setter): | 622 def AddSecondaryAttribute(self, interface, getter, setter): |
| 619 pass | 623 pass |
| 620 | 624 |
| 621 def AddSecondaryOperation(self, interface, info): | 625 def AddSecondaryOperation(self, interface, info): |
| 622 pass | 626 pass |
| 623 | 627 |
| 624 def AddIndexer(self, element_type): | 628 def AddIndexer(self, element_type): |
| 625 pass | 629 pass |
| 626 | 630 |
| 631 def AmendIndexer(sefl, element_type): |
| 632 pass |
| 633 |
| 627 def AddTypedArrayConstructors(self, element_type): | 634 def AddTypedArrayConstructors(self, element_type): |
| 628 pass | 635 pass |
| 629 | 636 |
| 630 def AddOperation(self, info): | 637 def AddOperation(self, info): |
| 631 pass | 638 pass |
| 632 | 639 |
| 633 def AddStaticOperation(self, info): | 640 def AddStaticOperation(self, info): |
| 634 pass | 641 pass |
| 635 | 642 |
| 636 def AddEventAttributes(self, event_attrs): | 643 def AddEventAttributes(self, event_attrs): |
| 637 pass | 644 pass |
| OLD | NEW |