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

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

Issue 9617041: Unwrap parameters in factory constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: add files Created 8 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
« no previous file with comments | « no previous file | client/dom/templates/html/dartium/factoryprovider_AudioElement.darttemplate » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/dom/scripts/systemhtml.py
diff --git a/client/dom/scripts/systemhtml.py b/client/dom/scripts/systemhtml.py
index 81629091995957d66559735a9e39bc829b3a24f6..4c4945780abf44ed016d8882e35531a62661add9 100644
--- a/client/dom/scripts/systemhtml.py
+++ b/client/dom/scripts/systemhtml.py
@@ -1251,7 +1251,18 @@ class HtmlDartiumInterfaceGenerator(object):
CONSTRUCTOR=interface_name,
PARAMETERS=constructor_info.ParametersImplementationDeclaration(),
NAMED_CONSTRUCTOR=constructor_info.name or interface_name,
- ARGUMENTS=constructor_info.ParametersAsArgumentList())
+ ARGUMENTS=self._UnwrappedParameters(constructor_info,
+ len(constructor_info.arg_infos)))
+
+ def _UnwrappedParameters(self, operation_info, length):
+ """Returns string for an argument list that unwraps first |length|
+ parameters."""
+ def UnwrapArgInfo(arg_info):
+ (name, type, value) = arg_info
+ # TODO(sra): Type dependent unwrapping.
+ return '_unwrap(%s)' % name
+
+ return ', '.join(map(UnwrapArgInfo, operation_info.arg_infos[:length]))
def _BaseClassName(self, interface):
if not interface.parents:
@@ -1585,22 +1596,10 @@ class HtmlDartiumInterfaceGenerator(object):
indent: an indentation string for generated code.
operation: the IDLOperation to call.
"""
- # TODO(sra): Do we need to distinguish calling with missing optional
- # arguments from passing 'null' which is represented as 'undefined'?
- def UnwrapArgExpression(name, type):
- # TODO: Type specific unwrapping.
- return '_unwrap(%s)' % (name)
-
- def ArgNameAndUnwrapper(arg_info, overload_arg):
- (name, type, value) = arg_info
- return (name, UnwrapArgExpression(name, type))
-
- names_and_unwrappers = [ArgNameAndUnwrapper(info.arg_infos[i], arg)
- for (i, arg) in enumerate(operation.arguments)]
- unwrap_args = [unwrap_arg for (_, unwrap_arg) in names_and_unwrappers]
- arg_names = ['_unwrap(%s)' % name for (name, _) in names_and_unwrappers]
+ argument_expressions = self._UnwrappedParameters(
+ info,
+ len(operation.arguments)) # Just the parameters this far.
- argument_expressions = ', '.join(arg_names)
if info.type_name != 'void':
# We could place the logic for handling Document directly in _wrap
# but we chose to place it here so that bugs in the wrapper and
« no previous file with comments | « no previous file | client/dom/templates/html/dartium/factoryprovider_AudioElement.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698