| OLD | NEW |
| 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 """Module to manage IDL files.""" | 6 """Module to manage IDL files.""" |
| 7 | 7 |
| 8 import copy | 8 import copy |
| 9 import pickle | 9 import pickle |
| 10 import logging | 10 import logging |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 | 240 |
| 241 def HasEnum(self, enum_name): | 241 def HasEnum(self, enum_name): |
| 242 return enum_name in self._enums | 242 return enum_name in self._enums |
| 243 | 243 |
| 244 def GetEnum(self, enum_name): | 244 def GetEnum(self, enum_name): |
| 245 return self._enums[enum_name] | 245 return self._enums[enum_name] |
| 246 | 246 |
| 247 def AddEnum(self, enum): | 247 def AddEnum(self, enum): |
| 248 self._enums[enum.id] = enum | 248 self._enums[enum.id] = enum |
| 249 | 249 |
| 250 def TransitiveSecondaryParents(self, interface): | 250 def TransitiveSecondaryParents(self, interface, propagate_event_target): |
| 251 """Returns a list of all non-primary parents. | 251 """Returns a list of all non-primary parents. |
| 252 | 252 |
| 253 The list contains the interface objects for interfaces defined in the | 253 The list contains the interface objects for interfaces defined in the |
| 254 database, and the name for undefined interfaces. | 254 database, and the name for undefined interfaces. |
| 255 """ | 255 """ |
| 256 def walk(parents): | 256 def walk(parents): |
| 257 for parent in parents: | 257 for parent in parents: |
| 258 parent_name = parent.type.id | 258 parent_name = parent.type.id |
| 259 if IsDartCollectionType(parent_name): | 259 if IsDartCollectionType(parent_name): |
| 260 result.append(parent_name) | 260 result.append(parent_name) |
| 261 continue | 261 continue |
| 262 if self.HasInterface(parent_name): | 262 if self.HasInterface(parent_name): |
| 263 parent_interface = self.GetInterface(parent_name) | 263 parent_interface = self.GetInterface(parent_name) |
| 264 result.append(parent_interface) | 264 result.append(parent_interface) |
| 265 walk(parent_interface.parents) | 265 walk(parent_interface.parents) |
| 266 | 266 |
| 267 result = [] | 267 result = [] |
| 268 if interface.parents: | 268 if interface.parents: |
| 269 parent = interface.parents[0] | 269 parent = interface.parents[0] |
| 270 if IsPureInterface(parent.type.id) or parent.type.id == 'EventTarget': | 270 if (IsPureInterface(parent.type.id) or |
| 271 (propagate_event_target and parent.type.id == 'EventTarget')): |
| 271 walk(interface.parents) | 272 walk(interface.parents) |
| 272 else: | 273 else: |
| 273 walk(interface.parents[1:]) | 274 walk(interface.parents[1:]) |
| 274 return result | 275 return result |
| 275 | 276 |
| OLD | NEW |