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

Unified Diff: Source/bindings/scripts/code_generator_v8.pm

Issue 141523002: Add null-correctness checking to [StrictTypeChecking] methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Last test Created 6 years, 11 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: Source/bindings/scripts/code_generator_v8.pm
diff --git a/Source/bindings/scripts/code_generator_v8.pm b/Source/bindings/scripts/code_generator_v8.pm
index d0e432ec7f81e3f741c9e4cbb065247bbfd9e98a..7049e34906461e34372730a4c937392cefe485b7 100644
--- a/Source/bindings/scripts/code_generator_v8.pm
+++ b/Source/bindings/scripts/code_generator_v8.pm
@@ -2778,7 +2778,8 @@ END
my $argValue = "info[$paramIndex]";
my $argType = $parameter->type;
if (IsWrapperType($argType)) {
- $parameterCheckString .= " if (info.Length() > $paramIndex && !isUndefinedOrNull($argValue) && !V8${argType}::hasInstance($argValue, info.GetIsolate(), worldType(info.GetIsolate()))) {\n";
+ my $undefinedNullCheck = $parameter->isNullable ? "isUndefinedOrNull($argValue)" : "${argValue}->IsUndefined()";
+ $parameterCheckString .= " if (info.Length() > $paramIndex && !$undefinedNullCheck && !V8${argType}::hasInstance($argValue, info.GetIsolate(), worldType(info.GetIsolate()))) {\n";
if ($hasExceptionState) {
$parameterCheckString .= " exceptionState.throwTypeError(\"parameter $humanFriendlyIndex is not of type \'$argType\'.\");\n";
$parameterCheckString .= " exceptionState.throwIfNeeded();\n";

Powered by Google App Engine
This is Rietveld 408576698