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

Unified Diff: tools/dom/scripts/database.py

Issue 1682783002: Dartium 45 roll (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: removed Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/dom/scripts/dartgenerator.py ('k') | tools/dom/scripts/databasebuilder.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/scripts/database.py
diff --git a/tools/dom/scripts/database.py b/tools/dom/scripts/database.py
index fc8b65905327549c25138e440266a14eab8cab12..19ca2224ee55b99e13d730e8adf30332fbed6f2d 100755
--- a/tools/dom/scripts/database.py
+++ b/tools/dom/scripts/database.py
@@ -44,6 +44,8 @@ class Database(object):
self._interfaces_to_delete = []
self._enums = {}
self._all_dictionaries = {}
+ # TODO(terry): Hack to remember all typedef unions.
+ self._all_type_defs = {}
def Clone(self):
new_database = Database(self._root_dir)
@@ -52,6 +54,7 @@ class Database(object):
self._interfaces_to_delete)
new_database._enums = copy.deepcopy(self._enums)
new_database._all_dictionaries = copy.deepcopy(self._all_dictionaries)
+ new_database._all_type_defs = copy.deepcopy(self._all_type_defs)
return new_database
@@ -282,6 +285,29 @@ class Database(object):
res.append(dictionary)
return res
+ def HasTypeDef(self, type_def_name):
+ """Returns True if the typedef is in memory"""
+ return type_def_name in self._all_type_defs
+
+ def GetTypeDef(self, type_def_name):
+ """Returns an IDLTypeDef corresponding to the type_def_name
+ from memory.
+
+ Args:
+ type_def_name -- the name of the typedef.
+ """
+ if type_def_name not in self._all_type_defs:
+ raise RuntimeError('Typedef %s is not loaded' % type_def_name)
+ return self._all_type_defs[type_def_name]
+
+ def AddTypeDef(self, type_def):
+ """Add only a typedef that a unions they map to any (no type)."""
+ type_def_name = type_def.id
+ if type_def_name in self._all_type_defs:
+ raise RuntimeError('Typedef %s already exists' % type_def_name)
+ self._all_type_defs[type_def_name] = type_def
+ print ' Added typedef %s' % type_def_name
+
def TransitiveSecondaryParents(self, interface, propagate_event_target):
"""Returns a list of all non-primary parents.
« no previous file with comments | « tools/dom/scripts/dartgenerator.py ('k') | tools/dom/scripts/databasebuilder.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698