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

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

Issue 11688005: Start unification of overload dispatcher generation. (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 508d9c672e4b67b2633c4e349c2995c47779b3bc..ca6789f8c7278f35b885432ae2a4aec9c2a5ae6a 100644
--- a/tools/dom/scripts/systemnative.py
+++ b/tools/dom/scripts/systemnative.py
@@ -451,7 +451,7 @@ class DartiumBackend(HtmlDartGenerator):
else:
self._GenerateDispatcher(info.operations, dart_declaration, [info.name for info in info.param_infos])
- def _GenerateDispatcher(self, operations, dart_declaration, argument_names):
+ def _GenerateDispatcher(self, operations, dart_declaration, parameter_names):
body = self._members_emitter.Emit(
'\n'
@@ -475,7 +475,7 @@ class DartiumBackend(HtmlDartGenerator):
overload_name = '%s_%s' % (operation.id, version[0])
version[0] += 1
- argument_list = ', '.join(argument_names[:argument_count])
+ argument_list = ', '.join(parameter_names[:argument_count])
call = '_%s(%s)' % (overload_name, argument_list)
body.Emit(template, CHECKS=' && '.join(checks), CALL=call)
@@ -489,15 +489,8 @@ class DartiumBackend(HtmlDartGenerator):
self._GenerateOperationNativeCallback(operation, operation.arguments[:argument_count], cpp_callback_name)
def GenerateChecksAndCall(operation, argument_count):
- checks = []
- for i in range(0, argument_count):
- argument = operation.arguments[i]
- argument_name = argument_names[i]
- type = self._DartType(argument.type.id)
- if type not in ['dynamic', 'Object']:
- checks.append('(%s is %s || %s == null)' % (argument_name, type, argument_name))
- checks.extend(['!?%s' % name for name in argument_names[argument_count:]])
- GenerateCall(operation, argument_count, checks)
+ GenerateCall(operation, argument_count,
+ self._OverloadChecks(operation, parameter_names, argument_count))
# TODO: Optimize the dispatch to avoid repeated checks.
if len(operations) > 1:
@@ -512,7 +505,7 @@ class DartiumBackend(HtmlDartGenerator):
argument_count = len(operation.arguments)
for position, argument in list(enumerate(operation.arguments))[::-1]:
if self._IsArgumentOptionalInWebCore(operation, argument):
- check = '?%s' % argument_names[position]
+ 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)
« 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