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

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

Issue 15885002: Verify that correct number of arguments was passed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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 | « tools/dom/scripts/generator.py ('k') | tools/dom/scripts/systemhtml.py » ('j') | 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 0dc105415817ab79c08e15ece11bbb821d4f9215..01ef3d74dddd18c6db9b33ceff3fecd9ef2a1581 100644
--- a/tools/dom/scripts/htmldartgenerator.py
+++ b/tools/dom/scripts/htmldartgenerator.py
@@ -201,6 +201,7 @@ class HtmlDartGenerator(object):
signatures,
is_void,
parameter_names,
+ number_of_required_in_dart,
declaration,
generate_call,
is_optional,
@@ -245,6 +246,9 @@ class HtmlDartGenerator(object):
elif not can_omit_type_check(test_type, i):
checks.append('(%s is %s || %s == null)' % (
parameter_name, test_type, parameter_name))
+ elif i > number_of_required_in_dart:
+ checks.append('?%s' % parameter_name)
+
# There can be multiple presence checks. We need them all since a later
# optional argument could have been passed by name, leaving 'holes'.
checks.extend(['!?%s' % name for name in parameter_names[argument_count:]])
@@ -300,6 +304,7 @@ class HtmlDartGenerator(object):
def _GenerateDispatcherBody(self,
operations,
parameter_names,
+ number_of_required_in_dart,
declaration,
generate_call,
is_optional,
@@ -318,6 +323,7 @@ class HtmlDartGenerator(object):
[operation.arguments for operation in operations],
operations[0].type.id == 'void',
parameter_names,
+ number_of_required_in_dart,
declaration,
GenerateCall,
IsOptional,
@@ -431,6 +437,7 @@ class HtmlDartGenerator(object):
constructor_info.idl_args,
False,
[info.name for info in constructor_info.param_infos],
+ constructor_info.NumberOfRequiredInDart(),
emitter.Format('$(METADATA)$FACTORY_KEYWORD $CTOR($PARAMS)',
FACTORY_KEYWORD=('factory' if not custom_factory_ctr else
'static %s' % constructor_full_name),
« no previous file with comments | « tools/dom/scripts/generator.py ('k') | tools/dom/scripts/systemhtml.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698