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

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

Issue 19820007: Fixes for Blink roll. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minors fixes Created 7 years, 5 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
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 """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
11 import os 11 import os
12 import os.path 12 import os.path
13 import shutil 13 import shutil
14 import idlnode 14 import idlnode
15 import idlparser 15 import idlparser
16 import idlrenderer 16 import idlrenderer
17 from generator import IsDartCollectionType, IsPureInterface
17 18
18 _logger = logging.getLogger('database') 19 _logger = logging.getLogger('database')
19 20
20 21
21 class Database(object): 22 class Database(object):
22 """The Database class manages a collection of IDL files stored 23 """The Database class manages a collection of IDL files stored
23 inside a directory. 24 inside a directory.
24 25
25 Each IDL is describing a single interface. The IDL files are written in the 26 Each IDL is describing a single interface. The IDL files are written in the
26 FremontCut syntax, which is derived from the Web IDL syntax and includes 27 FremontCut syntax, which is derived from the Web IDL syntax and includes
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 yield parent_interface 239 yield parent_interface
239 240
240 def HasEnum(self, enum_name): 241 def HasEnum(self, enum_name):
241 return enum_name in self._enums 242 return enum_name in self._enums
242 243
243 def GetEnum(self, enum_name): 244 def GetEnum(self, enum_name):
244 return self._enums[enum_name] 245 return self._enums[enum_name]
245 246
246 def AddEnum(self, enum): 247 def AddEnum(self, enum):
247 self._enums[enum.id] = enum 248 self._enums[enum.id] = enum
249
250 def TransitiveSecondaryParents(self, interface):
251 """Returns a list of all non-primary parents.
252
253 The list contains the interface objects for interfaces defined in the
254 database, and the name for undefined interfaces.
255 """
256 def walk(parents):
257 for parent in parents:
258 parent_name = parent.type.id
259 if parent_name == 'EventTarget':
260 # Currently EventTarget is implemented as a mixin, not a proper
261 # super interface---ignore its members.
262 continue
263 if IsDartCollectionType(parent_name):
264 result.append(parent_name)
265 continue
266 if self.HasInterface(parent_name):
267 parent_interface = self.GetInterface(parent_name)
268 result.append(parent_interface)
269 walk(parent_interface.parents)
270
271 result = []
272 if interface.parents:
273 parent = interface.parents[0]
274 if IsPureInterface(parent.type.id):
275 walk(interface.parents)
276 else:
277 walk(interface.parents[1:])
278 return result
279
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698