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

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

Issue 11896038: Some more refactorings of overload dispatcher generation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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
« tools/dom/scripts/htmldartgenerator.py ('K') | « 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 81023b6e9e6f869aaf5fe9a42cdac6c3ac2ccbe0..6154e8251dc0a89e835884f82a42f528f80ecf3d 100644
--- a/tools/dom/scripts/systemnative.py
+++ b/tools/dom/scripts/systemnative.py
@@ -451,31 +451,10 @@ class DartiumBackend(HtmlDartGenerator):
def _GenerateDispatcher(self, operations, dart_declaration, parameter_names):
- body = self._members_emitter.Emit(
- '\n'
- ' $DECLARATION {\n'
- '$!BODY'
- ' }\n',
- DECLARATION=dart_declaration)
-
- version = [1]
- def GenerateCall(operation, argument_count, checks):
- if checks:
- if operation.type.id != 'void':
- template = ' if ($CHECKS) {\n return $CALL;\n }\n'
- else:
- template = ' if ($CHECKS) {\n $CALL;\n return;\n }\n'
- else:
- if operation.type.id != 'void':
- template = ' return $CALL;\n'
- else:
- template = ' $CALL;\n'
-
- overload_name = '_%s_%s' % (operation.id, version[0])
- version[0] += 1
+ def GenerateCall(stmts_emitter, call_emitter, version, operation, argument_count):
Emily Fortuna 2013/01/22 19:16:40 80 char
Anton Muhin 2013/01/23 08:16:51 Done.
+ overload_name = '_%s_%s' % (operation.id, version)
argument_list = ', '.join(parameter_names[:argument_count])
- call = '%s(%s)' % (overload_name, argument_list)
- body.Emit(template, CHECKS=' && '.join(checks), CALL=call)
+ call_emitter.Emit('$NAME($ARGS)', NAME=overload_name, ARGS=argument_list)
dart_declaration = '%s%s %s(%s)' % (
'static ' if operation.is_static else '',
@@ -487,9 +466,9 @@ class DartiumBackend(HtmlDartGenerator):
self._GenerateOperationNativeCallback(operation, operation.arguments[:argument_count], cpp_callback_name)
self._GenerateDispatcherBody(
- body,
operations,
parameter_names,
+ dart_declaration,
GenerateCall,
self._IsArgumentOptionalInWebCore)
« tools/dom/scripts/htmldartgenerator.py ('K') | « tools/dom/scripts/systemhtml.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698