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

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

Issue 11359142: Fixing an issue where optional parameters were having their types dropped. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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/generator.py ('k') | no next file » | 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 90729a9f82a41d5724aa514398e3abb42d4f5ef6..b2892e51ffcbdc64feb265d421bc8be07580bd6a 100644
--- a/sdk/lib/html/scripts/systemhtml.py
+++ b/sdk/lib/html/scripts/systemhtml.py
@@ -309,7 +309,7 @@ class HtmlDartInterfaceGenerator(object):
merged_interface = self._interface_type_info.merged_interface()
if merged_interface:
- self._backend.AddMembers(self._database.GetInterface(merged_interface),
+ self._backend.AddMembers(self._database.GetInterface(merged_interface),
not self._backend.ImplementsMergedMembers())
self._backend.AddMembers(self._interface)
@@ -637,7 +637,6 @@ class Dart2JSBackend(HtmlDartGenerator):
def _AddOperationWithConversions(self, info, html_name):
# Assert all operations have same return type.
assert len(set([op.type.id for op in info.operations])) == 1
- info = info.CopyAndWidenDefaultParameters()
output_conversion = self._OutputConversion(info.type_name,
info.declared_name)
if output_conversion:
@@ -677,7 +676,7 @@ class Dart2JSBackend(HtmlDartGenerator):
(stmts_emitter, call_emitter) = body.Emit(
' if ($CHECKS) {\n$!STMTS$!CALL }\n',
INDENT=' ',
- CHECKS=' &&\n '.join(checks))
+ CHECKS=' && '.join(checks))
sra1 2012/11/09 21:34:41 Can you put this back?
blois 2012/11/09 23:20:41 Done :)
else:
(stmts_emitter, call_emitter) = body.Emit('$!A$!B', INDENT=' ');
@@ -707,12 +706,6 @@ class Dart2JSBackend(HtmlDartGenerator):
# Verified by argument checking on entry to the dispatcher.
verified_type = InputType(info.param_infos[position].type_id)
- # The native method does not need an argument type if we know the type.
- # But we do need the native methods to have correct function types, so
- # be conservative.
- if param_type == verified_type:
- if param_type in ['String', 'num', 'int', 'double', 'bool', 'Object']:
- param_type = 'dynamic'
sra1 2012/11/09 21:34:41 What is the effect of removing this on code size i
blois 2012/11/09 23:20:41 Done.
target_parameters.append(
'%s%s' % (TypeOrNothing(param_type), param_name))
@@ -746,8 +739,8 @@ class Dart2JSBackend(HtmlDartGenerator):
if test_type in ['dynamic', 'Object']:
checks.append('?%s' % parameter_name)
elif test_type != parameter_types[i]:
- checks.append('(%s is %s || %s == null)' % (
- parameter_name, test_type, parameter_name))
+ checks.append('(?%s && %s is %s)' % (parameter_name, parameter_name, test_type))
sra1 2012/11/09 21:34:41 This was not a null-means-missing check. If you ex
+
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'.
« no previous file with comments | « sdk/lib/html/scripts/generator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698