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

Unified Diff: lib/html/scripts/systemhtml.py

Issue 10913167: Rework overloads/optionals dispatch to use new ?a syntax. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 | « lib/html/scripts/generator.py ('k') | lib/html/scripts/systemnative.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/html/scripts/systemhtml.py
diff --git a/lib/html/scripts/systemhtml.py b/lib/html/scripts/systemhtml.py
index 2abfed2d85d1edecf4a0c69e84a2ab30b616046f..93c852e51cb8d2621b4fc2a37a86dac5c2454d2f 100644
--- a/lib/html/scripts/systemhtml.py
+++ b/lib/html/scripts/systemhtml.py
@@ -1076,7 +1076,7 @@ class HtmlDart2JSClassGenerator(Dart2JSInterfaceGenerator):
' }\n',
TYPE=return_type,
HTML_NAME=html_name,
- PARAMS=info.ParametersImplementationDeclaration(InputType, '_default'))
+ PARAMS=info.ParametersImplementationDeclaration(InputType))
parameter_names = [param_info.name for param_info in info.param_infos]
parameter_types = [InputType(param_info.dart_type)
@@ -1153,19 +1153,19 @@ class HtmlDart2JSClassGenerator(Dart2JSInterfaceGenerator):
NATIVE=info.declared_name)
def GenerateChecksAndCall(operation, argument_count):
- checks = ['_default == %s' % name for name in parameter_names]
+ checks = ['!?%s' % name for name in parameter_names]
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[i] = '_default != %s' % parameter_name
+ checks[i] = '?%s' % parameter_name
elif test_type == parameter_types[i]:
checks[i] = 'true'
else:
- checks[i] = '(%s is %s || %s == null)' % (
+ checks[i] = '(%s is %s || %s === null)' % (
parameter_name, test_type, parameter_name)
- # There can be multiple _default checks. We need them all since a later
+ # 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)
@@ -1184,7 +1184,7 @@ class HtmlDart2JSClassGenerator(Dart2JSInterfaceGenerator):
argument_count = len(operation.arguments)
for position, argument in list(enumerate(operation.arguments))[::-1]:
if self._IsOptional(operation, argument):
- check = '_default != %s' % parameter_names[position]
+ check = '?%s' % parameter_names[position]
GenerateCall(operation, position + 1, [check])
argument_count = position
GenerateCall(operation, argument_count, [])
« no previous file with comments | « lib/html/scripts/generator.py ('k') | lib/html/scripts/systemnative.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698