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

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

Issue 12531013: Expanded map options to named parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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: tools/dom/scripts/htmldartgenerator.py
diff --git a/tools/dom/scripts/htmldartgenerator.py b/tools/dom/scripts/htmldartgenerator.py
index cebafab4dd146659431d1b26536537b4950930a8..9af39d662fad5bc2e0c5c6e30dcbcbdaed55736d 100644
--- a/tools/dom/scripts/htmldartgenerator.py
+++ b/tools/dom/scripts/htmldartgenerator.py
@@ -23,6 +23,10 @@ _secure_base_types = {
'History': 'HistoryBase',
}
+_custom_factories = {
+ 'Notification',
+ 'EventSource',
+}
class HtmlDartGenerator(object):
def __init__(self, interface, options):
@@ -485,12 +489,18 @@ class HtmlDartGenerator(object):
def IsOptional(signature_index, argument):
return self.IsConstructorArgumentOptional(argument)
+ custom_factory_ctr = self._interface.id in _custom_factories
+ constructor_full_name = constructor_info._ConstructorFullName(
+ self._DartType)
self._GenerateOverloadDispatcher(
constructor_info.idl_args,
False,
[info.name for info in constructor_info.param_infos],
- emitter.Format('$(ANNOTATIONS)factory $CTOR($PARAMS)',
- CTOR=constructor_info._ConstructorFullName(self._DartType),
+ emitter.Format('$(ANNOTATIONS)$FACTORY_KEYWORD $CTOR($PARAMS)',
+ FACTORY_KEYWORD=('factory' if not custom_factory_ctr else
+ 'static %s' % constructor_full_name),
+ CTOR=(('' if not custom_factory_ctr else '_factory')
+ + constructor_full_name),
ANNOTATIONS=annotations,
PARAMS=constructor_info.ParametersDeclaration(self._DartType)),
GenerateCall,

Powered by Google App Engine
This is Rietveld 408576698