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

Unified Diff: lib/html/scripts/systembase.py

Issue 10986048: Get rid of System classes for backend generators. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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
Index: lib/html/scripts/systembase.py
diff --git a/lib/html/scripts/systembase.py b/lib/html/scripts/systembase.py
index 1e1f9491cdb82fc02080feebce7f32a706ee118b..700d412430fb4bf75fdeba6787c7b5f376de32d4 100644
--- a/lib/html/scripts/systembase.py
+++ b/lib/html/scripts/systembase.py
@@ -15,7 +15,7 @@ class System(object):
This is a base class for all the specific systems.
The life-cycle of a System is:
- construction (__init__)
- - (InterfaceGenerator | ProcessCallback)* # for each IDL interface
+ - (ProcessInterface)* # for each IDL interface
"""
def __init__(self, options):
@@ -28,11 +28,6 @@ class System(object):
"""Processes an interface that is not a callback function."""
pass
- def ProcessCallback(self, interface, info):
- """Processes an interface that is a callback function."""
- pass
-
-
# Helper methods used by several systems.
def _BaseDefines(self, interface):
@@ -58,16 +53,27 @@ class System(object):
return result
class BaseGenerator(object):
- def __init__(self, database, interface):
+ def __init__(self, database, type_registry, interface):
Anton Muhin 2012/09/26 14:20:36 maybe you should pass options here as well to unif
podivilov 2012/09/26 15:02:04 This class will be eventually merged into HtmlDart
self._database = database
+ self._type_registry = type_registry
self._interface = interface
def Generate(self):
+ if 'Callback' in self._interface.ext_attrs:
+ handlers = [operation for operation in self._interface.operations
+ if operation.id == 'handleEvent']
+ info = AnalyzeOperation(self._interface, handlers)
+ self.GenerateCallback(info)
+ return
+
self.StartInterface()
self.AddMembers(self._interface)
self.AddSecondaryMembers(self._interface)
self.FinishInterface()
+ def GenerateCallback(self, info):
+ pass
+
def AddMembers(self, interface):
for const in sorted(interface.constants, ConstantOutputOrder):
self.AddConstant(const)
@@ -171,8 +177,11 @@ class BaseGenerator(object):
walk(interface.parents[1:])
return result
+ def _TypeInfo(self, type_name):
+ return self._type_registry.TypeInfo(type_name)
+
def _DartType(self, type_name):
- return self._system._type_registry.DartType(type_name)
+ return self._type_registry.DartType(type_name)
class GeneratorOptions(object):

Powered by Google App Engine
This is Rietveld 408576698