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 3b6ffeb3d31a5e7db182dcc137091fec3f33ffe7..fe55583aa198c9b14ff762f0dd6f18a6bc76f14e 100644 |
--- a/Source/bindings/scripts/code_generator_v8.pm |
+++ b/Source/bindings/scripts/code_generator_v8.pm |
@@ -2475,7 +2475,14 @@ sub GenerateParametersCheck |
} elsif ($nativeType =~ /^V8StringResource/) { |
my $default = defined $parameter->extendedAttributes->{"Default"} ? $parameter->extendedAttributes->{"Default"} : ""; |
my $jsValue = $parameter->isOptional && $default eq "NullString" ? "argumentOrNull(args, $paramIndex)" : "args[$paramIndex]"; |
- $parameterCheckString .= JSValueToNativeStatement($parameter->type, $parameter->extendedAttributes, $jsValue, $parameterName, " ", "args.GetIsolate()"); |
+ my $stringResourceParameterName = $parameterName; |
+ my $isNullable = $parameter->isNullable && !IsRefPtrType($parameter->type); |
+ if ($isNullable) { |
+ $parameterCheckString .= " bool ${parameterName}IsNull = $jsValue->IsNull();\n"; |
+ $stringResourceParameterName .= "StringResource"; |
+ } |
+ $parameterCheckString .= JSValueToNativeStatement($parameter->type, $parameter->extendedAttributes, $jsValue, $stringResourceParameterName, " ", "args.GetIsolate()"); |
+ $parameterCheckString .= " String $parameterName = $stringResourceParameterName;\n" if $isNullable; |
if (IsEnumType($parameter->type)) { |
my @enumValues = ValidEnumValues($parameter->type); |
my @validEqualities = (); |
@@ -2508,6 +2515,8 @@ sub GenerateParametersCheck |
} |
my $default = defined $parameter->extendedAttributes->{"Default"} ? $parameter->extendedAttributes->{"Default"} : ""; |
my $jsValue = $parameter->isOptional && $default eq "NullString" ? "argumentOrNull(args, $paramIndex)" : "args[$paramIndex]"; |
+ my $isNullable = $parameter->isNullable && !IsRefPtrType($parameter->type); |
+ $parameterCheckString .= " bool ${parameterName}IsNull = $jsValue->IsNull();\n" if $isNullable; |
$parameterCheckString .= JSValueToNativeStatement($parameter->type, $parameter->extendedAttributes, $jsValue, $parameterName, " ", "args.GetIsolate()"); |
if ($nativeType eq 'Dictionary' or $nativeType eq 'ScriptPromise') { |
my $humanFriendlyIndex = $paramIndex + 1; |
@@ -5053,6 +5062,8 @@ sub GenerateFunctionCallString |
$code .= $indent . "}\n"; |
} elsif ($parameter->type eq "SVGMatrix" and $interfaceName eq "SVGTransformList") { |
push @arguments, "$paramName.get()"; |
+ } elsif ($parameter->isNullable && !IsRefPtrType($parameter->type)) { |
+ push @arguments, "${paramName}IsNull ? 0 : &$paramName"; |
} else { |
push @arguments, $paramName; |
} |