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

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

Issue 12518013: Ensure proper order of overload checks. (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 | « sdk/lib/html/dartium/html_dartium.dart ('k') | 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 7a8ad33bd616b45cb55998ab8445b1c16dfdf9e9..4d1366efa05ce55ec011761409c5944b938e6e1b 100644
--- a/tools/dom/scripts/htmldartgenerator.py
+++ b/tools/dom/scripts/htmldartgenerator.py
@@ -263,6 +263,25 @@ class HtmlDartGenerator(object):
# TODO: Optimize the dispatch to avoid repeated checks.
if len(signatures) > 1:
+ swapped = False
+ for signature_index, signature in enumerate(signatures):
+ for argument_position, argument in enumerate(signature):
+ if argument.type.id != 'ArrayBuffer':
+ continue
+ candidates = enumerate(
+ signatures[signature_index + 1:], signature_index + 1)
+ for candidate_index, candidate in candidates:
+ if len(candidate) <= argument_position:
+ continue
+ if candidate[argument_position].type.id != 'ArrayBufferView':
+ continue
+ if swapped:
+ raise Exception('Cannot deal with more than a single swap')
+ swapped = True
+ signatures = signatures[:]
+ signatures[candidate_index], signatures[signature_index] =\
+ signature, candidate
+
for signature_index, signature in enumerate(signatures):
for argument_position, argument in enumerate(signature):
if is_optional(signature_index, argument):
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698