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

Unified Diff: lib/dom/scripts/dartgenerator.py

Issue 10700006: Make per-interface generators an implementation detail of a system. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: . Created 8 years, 6 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 | « lib/dom/scripts/dartdomgenerator.py ('k') | lib/dom/scripts/generator.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/dom/scripts/dartgenerator.py
diff --git a/lib/dom/scripts/dartgenerator.py b/lib/dom/scripts/dartgenerator.py
index 333aa5a1aac0747e2398a77236cbd4c04aeac047..a7bab0fad90de1e0063d653b9f13901327d1dc86 100755
--- a/lib/dom/scripts/dartgenerator.py
+++ b/lib/dom/scripts/dartgenerator.py
@@ -186,14 +186,13 @@ class DartGenerator(object):
self.FilterMembersWithUnidentifiedTypes(database)
- def Generate(self, database, system, source_filter=None, super_database=None,
- common_prefix=None, webkit_renames={}):
+ def Generate(self, database, system, super_database=None, webkit_renames={}):
self._database = database
# Collect interfaces
interfaces = []
for interface in database.GetInterfaces():
- if not MatchSourceFilter(source_filter, interface):
+ if not MatchSourceFilter(interface):
# Skip this interface since it's not present in the required source
_logger.info('Omitting interface - %s' % interface.id)
continue
@@ -208,7 +207,6 @@ class DartGenerator(object):
# Render all interfaces into Dart and save them in files.
for interface in self._PreOrderInterfaces(interfaces):
- super_interface = None
super_name = interface.id
if super_name in super_map:
@@ -216,7 +214,7 @@ class DartGenerator(object):
if (super_database is not None and
super_database.HasInterface(super_name)):
- super_interface = super_name
+ interface.ext_attrs['synthesizedSuperInterfaceName'] = super_name
interface_name = interface.id
auxiliary_file = self._auxiliary_files.get(interface_name)
@@ -231,8 +229,8 @@ class DartGenerator(object):
else:
if 'Callback' in interface.ext_attrs:
_logger.info('Malformed callback: %s' % interface.id)
- self._ProcessInterface(system, interface, super_interface,
- source_filter, common_prefix)
+ _logger.info('Generating %s' % interface.id)
+ system.ProcessInterface(interface)
system.GenerateLibraries()
system.Finish()
@@ -257,52 +255,6 @@ class DartGenerator(object):
visit(interface)
return ordered
-
- def _ProcessInterface(self, system, interface, super_interface_name,
- source_filter,
- common_prefix):
- """."""
- _logger.info('Generating %s' % interface.id)
-
- generator = system.InterfaceGenerator(interface,
- common_prefix,
- super_interface_name,
- source_filter)
- if not generator:
- return
-
- generator.StartInterface()
- generator.AddMembers(interface)
- secondary_parents = self._TransitiveSecondaryParents(interface)
- generator.AddSecondaryMembers(interface, secondary_parents)
- generator.FinishInterface()
-
- def _TransitiveSecondaryParents(self, interface):
- """Returns a list of all non-primary parents.
-
- The list contains the interface objects for interfaces defined in the
- database, and the name for undefined interfaces.
- """
- def walk(parents):
- for parent in parents:
- if IsDartCollectionType(parent.type.id):
- result.append(parent.type.id)
- continue
- if self._database.HasInterface(parent.type.id):
- parent_interface = self._database.GetInterface(parent.type.id)
- result.append(parent_interface)
- walk(parent_interface.parents)
-
- result = []
- if interface.parents:
- parent = interface.parents[0]
- if IsPureInterface(parent.type.id):
- walk(interface.parents)
- else:
- walk(interface.parents[1:])
- return result;
-
-
def _CollectExceptions(self, interfaces):
"""Returns the names of all exception classes raised."""
exceptions = set()
@@ -344,12 +296,8 @@ class DummyImplementationSystem(systembase.System):
factory_providers_file)
self._impl_file_paths = [factory_providers_file]
- def InterfaceGenerator(self,
- interface,
- common_prefix,
- super_interface_name,
- source_filter):
- return DummyInterfaceGenerator(self, interface)
+ def ProcessInterface(self, interface):
+ DummyInterfaceGenerator(self, interface).Generate()
def ProcessCallback(self, interface, info):
pass
@@ -370,9 +318,8 @@ class DummyInterfaceGenerator(systembase.BaseGenerator):
"""Generates dummy implementation."""
def __init__(self, system, interface):
- super(DummyInterfaceGenerator, self).__init__(system._database)
+ super(DummyInterfaceGenerator, self).__init__(system._database, interface)
self._system = system
- self._interface = interface
def StartInterface(self):
# There is no implementation to match the interface, but there might be a
« no previous file with comments | « lib/dom/scripts/dartdomgenerator.py ('k') | lib/dom/scripts/generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698