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

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

Issue 15138002: Added tests to previously broken functionality and added null checks. (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
Index: tools/dom/scripts/htmldartgenerator.py
diff --git a/tools/dom/scripts/htmldartgenerator.py b/tools/dom/scripts/htmldartgenerator.py
index 0dc105415817ab79c08e15ece11bbb821d4f9215..571e55e2b1563d6ac6cb97ccbb49ea3099dd3372 100644
--- a/tools/dom/scripts/htmldartgenerator.py
+++ b/tools/dom/scripts/htmldartgenerator.py
@@ -240,11 +240,22 @@ class HtmlDartGenerator(object):
argument = signatures[signature_index][i]
parameter_name = parameter_names[i]
test_type = self._DartType(argument.type.id)
+ nullable = False or argument.type.nullable
Anton Muhin 2013/05/21 13:24:08 False or?
Andrei Mouravski 2013/05/21 18:39:14 I am not a smart person... :-) On 2013/05/21 13:
+
if test_type in ['dynamic', 'Object']:
checks.append('?%s' % parameter_name)
elif not can_omit_type_check(test_type, i):
+ nullable = True
checks.append('(%s is %s || %s == null)' % (
parameter_name, test_type, parameter_name))
+
+ if nullable is False:
Anton Muhin 2013/05/21 13:24:08 nit: if not nullable
Andrei Mouravski 2013/05/21 18:39:14 Done.
+ for signature in signatures:
+ if (argument not in signature or (len(signature) > i and
Anton Muhin 2013/05/21 13:24:08 why still argument not in signagture check
Andrei Mouravski 2013/05/21 18:39:14 Done.
+ signature[i] != argument)):
+ checks.append('%s != null' % parameter_name)
+ break
+
# 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:]])

Powered by Google App Engine
This is Rietveld 408576698