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

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

Issue 9428050: Automatically generate most constructors (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: add test Created 8 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 | « client/dom/generated/src/interface/XPathEvaluator.dart ('k') | client/dom/scripts/generator.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/dom/scripts/dartgenerator.py
diff --git a/client/dom/scripts/dartgenerator.py b/client/dom/scripts/dartgenerator.py
index f46f7029184b9bf28f8eec4c7cc71c32d95f634e..0b966129afc6f3269ba46593142d64a6779a895b 100755
--- a/client/dom/scripts/dartgenerator.py
+++ b/client/dom/scripts/dartgenerator.py
@@ -629,6 +629,11 @@ class DummyImplementationSystem(System):
def __init__(self, templates, database, emitters, output_dir):
super(DummyImplementationSystem, self).__init__(
templates, database, emitters, output_dir)
+ factory_providers_file = os.path.join(self._output_dir, 'src', 'dummy',
+ 'RegularFactoryProviders.dart')
+ self._factory_providers_emitter = self._emitters.FileEmitter(
+ factory_providers_file)
+ self._impl_file_paths = [factory_providers_file]
def InterfaceGenerator(self,
interface,
@@ -647,21 +652,33 @@ class DummyImplementationSystem(System):
os.path.join(lib_dir, 'dom_dummy.dart'),
(self._interface_system._dart_interface_file_paths +
self._interface_system._dart_callback_file_paths +
- []
- # FIXME: Move the implementation to a separate library.
- # self._dart_wrapping_file_paths
- ))
+ self._impl_file_paths))
+
# ------------------------------------------------------------------------------
class DummyInterfaceGenerator(object):
- """Generates nothing."""
+ """Generates dummy implementation."""
def __init__(self, system, interface):
- pass
+ self._system = system
+ self._interface = interface
def StartInterface(self):
- pass
+ # There is no implementation to match the interface, but there might be a
+ # factory constructor for the Dart interface.
+ constructor_info = AnalyzeConstructor(self._interface)
+ if constructor_info:
+ dart_interface_name = self._interface.id
+ self._EmitFactoryProvider(dart_interface_name, constructor_info)
+
+ def _EmitFactoryProvider(self, interface_name, constructor_info):
+ factory_provider = '_' + interface_name + 'FactoryProvider'
+ self._system._factory_providers_emitter.Emit(
+ self._system._templates.Load('factoryprovider.darttemplate'),
+ FACTORYPROVIDER=factory_provider,
+ CONSTRUCTOR=interface_name,
+ PARAMETERS=constructor_info.ParametersImplementationDeclaration())
def FinishInterface(self):
pass
« no previous file with comments | « client/dom/generated/src/interface/XPathEvaluator.dart ('k') | client/dom/scripts/generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698