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

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

Issue 11720002: Next step in overload dispatcher refactoring. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 | « tools/dom/scripts/systemhtml.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/scripts/systemnative.py
diff --git a/tools/dom/scripts/systemnative.py b/tools/dom/scripts/systemnative.py
index ca6789f8c7278f35b885432ae2a4aec9c2a5ae6a..3a2584278d5eedc1b12ee5b67127e596b01c3ab9 100644
--- a/tools/dom/scripts/systemnative.py
+++ b/tools/dom/scripts/systemnative.py
@@ -488,34 +488,12 @@ class DartiumBackend(HtmlDartGenerator):
dart_declaration, 'Callback', False)
self._GenerateOperationNativeCallback(operation, operation.arguments[:argument_count], cpp_callback_name)
- def GenerateChecksAndCall(operation, argument_count):
- GenerateCall(operation, argument_count,
- self._OverloadChecks(operation, parameter_names, argument_count))
-
- # TODO: Optimize the dispatch to avoid repeated checks.
- if len(operations) > 1:
- for operation in operations:
- for position, argument in enumerate(operation.arguments):
- if self._IsArgumentOptionalInWebCore(operation, argument):
- GenerateChecksAndCall(operation, position)
- GenerateChecksAndCall(operation, len(operation.arguments))
- body.Emit(' throw "Incorrect number or type of arguments";\n');
- else:
- operation = operations[0]
- argument_count = len(operation.arguments)
- for position, argument in list(enumerate(operation.arguments))[::-1]:
- if self._IsArgumentOptionalInWebCore(operation, argument):
- check = '?%s' % parameter_names[position]
- # argument_count instead of position + 1 is used here to cover one
- # complicated case with the effectively optional argument in the middle.
- # Consider foo(x, [Optional] y, [Optional=DefaultIsNullString] z)
- # (as of now it's modelled after HTMLMediaElement.webkitAddKey).
- # y is optional in WebCore, while z is not.
- # In this case, if y was actually passed, we'd like to emit foo(x, y, z) invocation,
- # not foo(x, y).
- GenerateCall(operation, argument_count, [check])
- argument_count = position
- GenerateCall(operation, argument_count, [])
+ self._GenerateDispatcherBody(
+ body,
+ operations,
+ parameter_names,
+ GenerateCall,
+ self._IsArgumentOptionalInWebCore)
def SecondaryContext(self, interface):
pass
« no previous file with comments | « tools/dom/scripts/systemhtml.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698