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

Side by Side Diff: tools/dom/scripts/htmldartgenerator.py

Issue 23064024: Attempt to land Dartium roll a second time. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 months 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 | « tools/dom/scripts/generator.py ('k') | tools/dom/scripts/htmleventgenerator.py » ('j') | 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) 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 system to generate 6 """This module provides shared functionality for the system to generate
7 dart:html APIs from the IDL database.""" 7 dart:html APIs from the IDL database."""
8 8
9 import emitter 9 import emitter
10 from generator import AnalyzeOperation, ConstantOutputOrder, \ 10 from generator import AnalyzeOperation, ConstantOutputOrder, \
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 "EventTarget.removeEventListener, EventTarget.dispatchEvent')" 65 "EventTarget.removeEventListener, EventTarget.dispatchEvent')"
66 "\n @deprecated" 66 "\n @deprecated"
67 "\n $TYPE get on =>\n new $TYPE(this);\n", 67 "\n $TYPE get on =>\n new $TYPE(this);\n",
68 TYPE=events_class_name) 68 TYPE=events_class_name)
69 69
70 def AddMembers(self, interface, declare_only=False): 70 def AddMembers(self, interface, declare_only=False):
71 for const in sorted(interface.constants, ConstantOutputOrder): 71 for const in sorted(interface.constants, ConstantOutputOrder):
72 self.AddConstant(const) 72 self.AddConstant(const)
73 73
74 for attr in sorted(interface.attributes, ConstantOutputOrder): 74 for attr in sorted(interface.attributes, ConstantOutputOrder):
75 if attr.type.id != 'EventListener': 75 if attr.type.id != 'EventHandler' and attr.type.id != 'EventListener':
76 self.AddAttribute(attr, declare_only) 76 self.AddAttribute(attr, declare_only)
77 77
78 # The implementation should define an indexer if the interface directly 78 # The implementation should define an indexer if the interface directly
79 # extends List. 79 # extends List.
80 element_type = None 80 element_type = None
81 requires_indexer = False 81 requires_indexer = False
82 if self._interface_type_info.list_item_type(): 82 if self._interface_type_info.list_item_type():
83 self.AddIndexer(self._interface_type_info.list_item_type()) 83 self.AddIndexer(self._interface_type_info.list_item_type())
84 else: 84 else:
85 for parent in self._database.Hierarchy(self._interface): 85 for parent in self._database.Hierarchy(self._interface):
(...skipping 24 matching lines...) Expand all
110 # With multiple inheritance, attributes and operations of non-first 110 # With multiple inheritance, attributes and operations of non-first
111 # interfaces need to be added. Sometimes the attribute or operation is 111 # interfaces need to be added. Sometimes the attribute or operation is
112 # defined in the current interface as well as a parent. In that case we 112 # defined in the current interface as well as a parent. In that case we
113 # avoid making a duplicate definition and pray that the signatures match. 113 # avoid making a duplicate definition and pray that the signatures match.
114 secondary_parents = self._database.TransitiveSecondaryParents(interface) 114 secondary_parents = self._database.TransitiveSecondaryParents(interface)
115 for parent_interface in sorted(secondary_parents): 115 for parent_interface in sorted(secondary_parents):
116 if isinstance(parent_interface, str): 116 if isinstance(parent_interface, str):
117 continue 117 continue
118 for attr in sorted(parent_interface.attributes, ConstantOutputOrder): 118 for attr in sorted(parent_interface.attributes, ConstantOutputOrder):
119 if not FindMatchingAttribute(interface, attr): 119 if not FindMatchingAttribute(interface, attr):
120 if attr.type.id != 'EventListener': 120 if attr.type.id != 'EventHandler':
121 self.SecondaryContext(parent_interface) 121 self.SecondaryContext(parent_interface)
122 self.AddAttribute(attr) 122 self.AddAttribute(attr)
123 123
124 # Group overloaded operations by name. 124 # Group overloaded operations by name.
125 operationsByName =self._OperationsByName(parent_interface) 125 operationsByName =self._OperationsByName(parent_interface)
126 126
127 if self.OmitOperationOverrides(): 127 if self.OmitOperationOverrides():
128 self._RemoveShadowingOperationsWithSameSignature(operationsByName, 128 self._RemoveShadowingOperationsWithSameSignature(operationsByName,
129 interface) 129 interface)
130 130
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 if dart_name == 'Window': 663 if dart_name == 'Window':
664 return _secure_base_types[dart_name] 664 return _secure_base_types[dart_name]
665 return dart_name 665 return dart_name
666 666
667 def SecureBaseName(self, type_name): 667 def SecureBaseName(self, type_name):
668 if type_name in _secure_base_types: 668 if type_name in _secure_base_types:
669 return _secure_base_types[type_name] 669 return _secure_base_types[type_name]
670 670
671 def _DartType(self, type_name): 671 def _DartType(self, type_name):
672 return self._type_registry.DartType(type_name) 672 return self._type_registry.DartType(type_name)
OLDNEW
« no previous file with comments | « tools/dom/scripts/generator.py ('k') | tools/dom/scripts/htmleventgenerator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698