Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: client/dom/scripts/dartgenerator.py

Issue 8894029: Generate EventListener attributes of non-EventTarget classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/dom/idl/dart/webkit-supplemental.idl ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2011, 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 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 frog_interface_generator] 726 frog_interface_generator]
727 727
728 for generator in generators: 728 for generator in generators:
729 generator.StartInterface() 729 generator.StartInterface()
730 730
731 for const in sorted(interface.constants, ConstantOutputOrder): 731 for const in sorted(interface.constants, ConstantOutputOrder):
732 for generator in generators: 732 for generator in generators:
733 generator.AddConstant(const) 733 generator.AddConstant(const)
734 734
735 for attr in sorted(interface.attributes, AttributeOutputOrder): 735 for attr in sorted(interface.attributes, AttributeOutputOrder):
736 if attr.type.id == 'EventListener': continue 736 if attr.type.id == 'EventListener':
737 # Remove EventListener attributes when addEventListener is available.
738 if 'EventTarget' in self._AllImplementedInterfaces(interface):
739 continue
737 if attr.is_fc_getter: 740 if attr.is_fc_getter:
738 for generator in generators: 741 for generator in generators:
739 generator.AddGetter(attr) 742 generator.AddGetter(attr)
740 elif attr.is_fc_setter: 743 elif attr.is_fc_setter:
741 for generator in generators: 744 for generator in generators:
742 generator.AddSetter(attr) 745 generator.AddSetter(attr)
743 746
744 # The implementation should define an indexer if the interface directly 747 # The implementation should define an indexer if the interface directly
745 # extends List. 748 # extends List.
746 element_type = MaybeListElementType(interface) 749 element_type = MaybeListElementType(interface)
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 for interface in self._database.GetInterfaces(): 1125 for interface in self._database.GetInterfaces():
1123 seen = set() 1126 seen = set()
1124 collected = [] 1127 collected = []
1125 Collect(interface, seen, collected) 1128 Collect(interface, seen, collected)
1126 self._inheritance_closure[interface.id] = collected 1129 self._inheritance_closure[interface.id] = collected
1127 1130
1128 def _AllImplementedInterfaces(self, interface): 1131 def _AllImplementedInterfaces(self, interface):
1129 """Returns a list of the names of all interfaces implemented by 'interface'. 1132 """Returns a list of the names of all interfaces implemented by 'interface'.
1130 List includes the name of 'interface'. 1133 List includes the name of 'interface'.
1131 """ 1134 """
1135 if not self._inheritance_closure:
1136 self._ComputeInheritanceClosure()
1132 return self._inheritance_closure[interface.id] 1137 return self._inheritance_closure[interface.id]
1133 1138
1134 def _GenerateProtoMap(self): 1139 def _GenerateProtoMap(self):
1135 """Determine which DOM type prototypes can be obtained 1140 """Determine which DOM type prototypes can be obtained
1136 from window properties. 1141 from window properties.
1137 """ 1142 """
1138 window = None 1143 window = None
1139 for interface in self._database.GetInterfaces(): 1144 for interface in self._database.GetInterfaces():
1140 if interface.id == 'DOMWindow': 1145 if interface.id == 'DOMWindow':
1141 window = interface 1146 window = interface
(...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after
2493 Arguments: 2498 Arguments:
2494 info: An OperationInfo object. 2499 info: An OperationInfo object.
2495 """ 2500 """
2496 # TODO(vsm): Handle overloads. 2501 # TODO(vsm): Handle overloads.
2497 self._members_emitter.Emit( 2502 self._members_emitter.Emit(
2498 '\n' 2503 '\n'
2499 ' $TYPE $NAME($ARGS) native;\n', 2504 ' $TYPE $NAME($ARGS) native;\n',
2500 TYPE=info.type_name, 2505 TYPE=info.type_name,
2501 NAME=info.name, 2506 NAME=info.name,
2502 ARGS=info.arg_implementation_declaration) 2507 ARGS=info.arg_implementation_declaration)
OLDNEW
« no previous file with comments | « client/dom/idl/dart/webkit-supplemental.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698