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

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

Issue 569783002: Migrate to Chrome 37 IDL (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « tools/dom/scripts/generator.py ('k') | tools/dom/scripts/htmlrenamer.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 a98233565640a244683986b85cd118bc35d0ef8f..d2b4f3eb458d9326e62f6d2e5600e27a8fe93b20 100644
--- a/tools/dom/scripts/htmldartgenerator.py
+++ b/tools/dom/scripts/htmldartgenerator.py
@@ -354,6 +354,10 @@ class HtmlDartGenerator(object):
def GenerateChecksAndCall(signature_index, argument_count):
checks = []
+ typechecked_interface = \
+ ('TypeChecking' in self._interface.ext_attrs) and \
+ ('Interface' in self._interface.ext_attrs['TypeChecking'])
+
for i in reversed(range(0, argument_count)):
argument = signatures[signature_index][i]
parameter_name = parameter_names[i]
@@ -363,8 +367,19 @@ class HtmlDartGenerator(object):
if test_type in ['dynamic', 'Object']:
checks.append('%s != null' % parameter_name)
elif not can_omit_type_check(test_type, i):
- checks.append('(%s is %s || %s == null)' % (
- parameter_name, test_type, parameter_name))
+ typechecked = typechecked_interface or \
+ ('TypeChecking' in argument.ext_attrs) and \
+ ('Interface' in argument.ext_attrs['TypeChecking'])
+ converts_null = \
+ ('TreatNullAs' in argument.ext_attrs) or \
+ (argument.default_value is not None) or \
+ (argument.default_value_is_null)
+ if argument.type.nullable or converts_null or not typechecked:
+ checks.append('(%s is %s || %s == null)' % (
+ parameter_name, test_type, parameter_name))
+ else:
+ checks.append('(%s is %s)' % (
+ parameter_name, test_type))
elif i >= number_of_required_in_dart:
checks.append('%s != null' % parameter_name)
« no previous file with comments | « tools/dom/scripts/generator.py ('k') | tools/dom/scripts/htmlrenamer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698