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

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

Issue 551713003: Fix handling default parameters (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Cleanup Created 6 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
Index: tools/dom/scripts/generator.py
diff --git a/tools/dom/scripts/generator.py b/tools/dom/scripts/generator.py
index 950c9ae8325739742356b7b8d48d42566c24ba19..73e36763e37ec9bd54a09d0b46f5090433706886 100644
--- a/tools/dom/scripts/generator.py
+++ b/tools/dom/scripts/generator.py
@@ -228,7 +228,7 @@ def _BuildArguments(args, interface, constructor=False):
# FIXME: Optional constructors arguments should not be treated as
# optional arguments.
return argument.optional
- if 'ForceOptional' in argument.ext_attrs:
+ if 'DartForceOptional' in argument.ext_attrs:
return True
return False
@@ -262,9 +262,13 @@ def _BuildArguments(args, interface, constructor=False):
return result
+# Argument default value set (literal value or null).
+def HasDefault(argument):
+ return (argument.default_value != None) or argument.default_value_is_null
+
def IsOptional(argument):
- return argument.optional and ('Default' not in argument.ext_attrs)\
- or 'ForceOptional' in argument.ext_attrs
+ return argument.optional and (not(HasDefault(argument))) \
+ or 'DartForceOptional' in argument.ext_attrs
def AnalyzeOperation(interface, operations):
"""Makes operation calling convention decision for a set of overloads.

Powered by Google App Engine
This is Rietveld 408576698