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

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

Issue 12660007: Maintain proper signature_index. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/scripts/htmldartgenerator.py
diff --git a/tools/dom/scripts/htmldartgenerator.py b/tools/dom/scripts/htmldartgenerator.py
index 4d1366efa05ce55ec011761409c5944b938e6e1b..cebafab4dd146659431d1b26536537b4950930a8 100644
--- a/tools/dom/scripts/htmldartgenerator.py
+++ b/tools/dom/scripts/htmldartgenerator.py
@@ -263,7 +263,7 @@ class HtmlDartGenerator(object):
# TODO: Optimize the dispatch to avoid repeated checks.
if len(signatures) > 1:
- swapped = False
+ index_swaps = {}
for signature_index, signature in enumerate(signatures):
for argument_position, argument in enumerate(signature):
if argument.type.id != 'ArrayBuffer':
@@ -275,14 +275,14 @@ class HtmlDartGenerator(object):
continue
if candidate[argument_position].type.id != 'ArrayBufferView':
continue
- if swapped:
+ if len(index_swaps):
raise Exception('Cannot deal with more than a single swap')
- swapped = True
- signatures = signatures[:]
- signatures[candidate_index], signatures[signature_index] =\
- signature, candidate
+ index_swaps[candidate_index] = signature_index
+ index_swaps[signature_index] = candidate_index
- for signature_index, signature in enumerate(signatures):
+ for signature_index in range(len(signatures)):
+ signature_index = index_swaps.get(signature_index, signature_index)
+ signature = signatures[signature_index]
for argument_position, argument in enumerate(signature):
if is_optional(signature_index, argument):
GenerateChecksAndCall(signature_index, argument_position)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698