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

Unified Diff: tools/dom/scripts/systemhtml.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/htmldartgenerator.py ('k') | tools/dom/scripts/systemnative.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/scripts/systemhtml.py
diff --git a/tools/dom/scripts/systemhtml.py b/tools/dom/scripts/systemhtml.py
index c8ba61bd58f733b99621cd44b9d02280f1ccdb94..023ccc9c1d0eb66451b51da95a27407c0c8ab576 100644
--- a/tools/dom/scripts/systemhtml.py
+++ b/tools/dom/scripts/systemhtml.py
@@ -855,33 +855,13 @@ class Dart2JSBackend(HtmlDartGenerator):
TARGET=target,
PARAMS=', '.join(target_parameters))
- def GenerateChecksAndCall(operation, argument_count):
- GenerateCall(operation, argument_count,
- self._OverloadChecks(
- operation,
- parameter_names,
- argument_count,
- can_omit_type_check=lambda type, pos: type == parameter_types[pos]))
-
- # 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._IsOptional(operation, argument):
- GenerateChecksAndCall(operation, position)
- GenerateChecksAndCall(operation, len(operation.arguments))
- body.Emit(
- ' throw new ArgumentError("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._IsOptional(operation, argument):
- check = '?%s' % parameter_names[position]
- GenerateCall(operation, position + 1, [check])
- argument_count = position
- GenerateCall(operation, argument_count, [])
+ self._GenerateDispatcherBody(
+ body,
+ operations,
+ parameter_names,
+ GenerateCall,
+ self._IsOptional,
+ can_omit_type_check=lambda type, pos: type == parameter_types[pos])
def _AddInterfaceOperation(self, info, html_name):
self._members_emitter.Emit(
« no previous file with comments | « tools/dom/scripts/htmldartgenerator.py ('k') | tools/dom/scripts/systemnative.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698