Index: Source/bindings/scripts/CodeGeneratorV8.pm |
diff --git a/Source/bindings/scripts/CodeGeneratorV8.pm b/Source/bindings/scripts/CodeGeneratorV8.pm |
index dbb1c56a26978f9f8378e0c343b7f91931113a41..d8eeae40825a3cced5ca7a541551719d5c75befe 100644 |
--- a/Source/bindings/scripts/CodeGeneratorV8.pm |
+++ b/Source/bindings/scripts/CodeGeneratorV8.pm |
@@ -2139,6 +2139,31 @@ END |
push(@implContentInternals, "\n"); |
} |
+sub GetConstructorLength |
+{ |
+ my $interface = shift; |
+ |
+ my $numberOfConstructorParameters = $interface->extendedAttributes->{"ConstructorParameters"}; |
+ if (!defined $numberOfConstructorParameters) { |
+ if ($codeGenerator->IsConstructorTemplate($interface, "Event")) { |
+ $numberOfConstructorParameters = 2; |
+ } elsif ($codeGenerator->IsConstructorTemplate($interface, "TypedArray")) { |
+ $numberOfConstructorParameters = 1; |
+ } elsif ($interface->extendedAttributes->{"Constructor"}) { |
+ my @constructors = @{$interface->constructors}; |
+ $numberOfConstructorParameters = 255; |
+ foreach my $constructor (@constructors) { |
+ my $currNumberOfParameters = @{$constructor->parameters}; |
+ if ($currNumberOfParameters < $numberOfConstructorParameters) { |
+ $numberOfConstructorParameters = $currNumberOfParameters; |
haraken
2013/04/16 00:29:31
I'm not sure if this is correct. Per the spec, it
do-not-use
2013/04/16 07:26:23
Sorry, could you point me to the part where it say
do-not-use
2013/04/16 09:39:20
Actually, the latest Editor Draft matches the beha
|
+ } |
+ } |
+ } |
+ } |
+ |
+ return $numberOfConstructorParameters; |
+} |
+ |
sub GenerateConstructorCallback |
{ |
my $interface = shift; |
@@ -3048,10 +3073,11 @@ END |
if ($function->signature->extendedAttributes->{"PerWorldBindings"}) { |
$methodForMainWorld = "${interfaceName}V8Internal::${name}MethodCallbackForMainWorld"; |
} |
+ my $numParams = @{$function->parameters}; |
my $conditionalString = $codeGenerator->GenerateConditionalString($function->signature); |
push(@implContent, "#if ${conditionalString}\n") if $conditionalString; |
push(@implContent, <<END); |
- {"$name", ${interfaceName}V8Internal::${name}MethodCallback, ${methodForMainWorld}}, |
+ {"$name", ${interfaceName}V8Internal::${name}MethodCallback, ${methodForMainWorld}, ${numParams}}, |
END |
push(@implContent, "#endif\n") if $conditionalString; |
$num_callbacks++; |
@@ -3186,6 +3212,8 @@ END |
if (IsConstructable($interface)) { |
push(@implContent, " desc->SetCallHandler(${v8InterfaceName}::constructorCallback);\n"); |
+ my $constructorLength = GetConstructorLength($interface); |
+ push(@implContent, " desc->SetLength(${constructorLength});\n") if defined $constructorLength; |
haraken
2013/04/16 00:29:31
'if defined' is not needed.
|
} |
if ($access_check or @enabledAtRuntimeAttributes or @normalFunctions or $has_constants) { |