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

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: Correctly check for position. 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..1032f706ad2d6b50d953b1c733016326577f4943 100644
--- a/tools/dom/scripts/htmldartgenerator.py
+++ b/tools/dom/scripts/htmldartgenerator.py
@@ -240,11 +240,21 @@ 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
+
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 not nullable:
+ for signature in signatures:
+ if (len(signature) <= i or 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:]])
« sdk/lib/web_gl/dart2js/web_gl_dart2js.dart ('K') | « tests/html/canvasrenderingcontext2d_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698