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 for const in sorted(interface.constants, ConstantOutputOrder): | 389 for const in sorted(interface.constants, ConstantOutputOrder): |
390 for generator in generators: | 390 for generator in generators: |
391 generator.AddConstant(const) | 391 generator.AddConstant(const) |
392 | 392 |
393 attributes = [attr for attr in interface.attributes | 393 attributes = [attr for attr in interface.attributes |
394 if not self._IsEventAttribute(interface, attr)] | 394 if not self._IsEventAttribute(interface, attr)] |
395 for (getter, setter) in _PairUpAttributes(attributes): | 395 for (getter, setter) in _PairUpAttributes(attributes): |
396 for generator in generators: | 396 for generator in generators: |
397 generator.AddAttribute(getter, setter) | 397 generator.AddAttribute(getter, setter) |
398 | 398 |
399 events = set([attr for attr in interface.attributes | |
400 if self._IsEventAttribute(interface, attr)]) | |
401 | |
402 if events: | |
403 for generator in generators: | |
404 generator.AddEventAttributes(events) | |
405 | |
406 # The implementation should define an indexer if the interface directly | 399 # The implementation should define an indexer if the interface directly |
407 # extends List. | 400 # extends List. |
408 element_type = MaybeListElementType(interface) | 401 element_type = MaybeListElementType(interface) |
409 if element_type: | 402 if element_type: |
410 for generator in generators: | 403 for generator in generators: |
411 generator.AddIndexer(element_type) | 404 generator.AddIndexer(element_type) |
412 # Group overloaded operations by id | 405 # Group overloaded operations by id |
413 operationsById = {} | 406 operationsById = {} |
414 for operation in interface.operations: | 407 for operation in interface.operations: |
415 if operation.id not in operationsById: | 408 if operation.id not in operationsById: |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 pass | 660 pass |
668 | 661 |
669 def AddTypedArrayConstructors(self, element_type): | 662 def AddTypedArrayConstructors(self, element_type): |
670 pass | 663 pass |
671 | 664 |
672 def AddOperation(self, info): | 665 def AddOperation(self, info): |
673 pass | 666 pass |
674 | 667 |
675 def AddEventAttributes(self, event_attrs): | 668 def AddEventAttributes(self, event_attrs): |
676 pass | 669 pass |
OLD | NEW |