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

Unified Diff: sdk/lib/html/scripts/systemhtml.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 | « sdk/lib/html/scripts/htmldartgenerator.py ('k') | sdk/lib/html/scripts/systemnative.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/scripts/systemhtml.py
diff --git a/sdk/lib/html/scripts/systemhtml.py b/sdk/lib/html/scripts/systemhtml.py
index 438fde8c239a51d1f07f04ac9008a6c736cf229d..ead8bd024e75be29333ecd0503602411683ba34b 100644
--- a/sdk/lib/html/scripts/systemhtml.py
+++ b/sdk/lib/html/scripts/systemhtml.py
@@ -802,21 +802,12 @@ class Dart2JSBackend(HtmlDartGenerator):
PARAMS=', '.join(target_parameters))
def GenerateChecksAndCall(operation, argument_count):
- checks = []
- for i in range(0, argument_count):
- argument = operation.arguments[i]
- parameter_name = parameter_names[i]
- test_type = self._DartType(argument.type.id)
- if test_type in ['dynamic', 'Object']:
- checks.append('?%s' % parameter_name)
- elif test_type != parameter_types[i]:
- checks.append('(?%s && (%s is %s || %s == null))' % (
- parameter_name, parameter_name, test_type, parameter_name))
-
- checks.extend(['!?%s' % name for name in parameter_names[argument_count:]])
- # There can be multiple presence checks. We need them all since a later
- # optional argument could have been passed by name, leaving 'holes'.
- GenerateCall(operation, argument_count, checks)
+ GenerateCall(operation, argument_count,
+ self._OverloadChecks(
podivilov 2012/12/28 16:17:16 maybe introduce a local?
Anton Muhin 2012/12/29 12:02:12 Let's see how the things will unfold.
+ 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:
« no previous file with comments | « sdk/lib/html/scripts/htmldartgenerator.py ('k') | sdk/lib/html/scripts/systemnative.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698