| 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 9cac0b41728a4eb89c22963048583cb87f6694bb..dd411118016747fc2c7e595fd7b1658e704c0a53 100644
|
| --- a/Source/bindings/scripts/code_generator_v8.pm
|
| +++ b/Source/bindings/scripts/code_generator_v8.pm
|
| @@ -2701,13 +2701,10 @@ sub GenerateOverloadedConstructorCallback
|
| my $interfaceName = $interface->name;
|
| my $implClassName = GetImplName($interface);
|
|
|
| - my $hasExceptionState = 0;
|
| - my $header = "";
|
| - $header .= <<END;
|
| + my $code .= <<END;
|
| static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| END
|
| - my $code = "";
|
| my $leastNumMandatoryParams = 255;
|
| foreach my $constructor (@{$interface->constructors}) {
|
| my $name = "constructor" . $constructor->overloadedIndex;
|
| @@ -2718,31 +2715,25 @@ END
|
| $code .= " return;\n";
|
| $code .= " }\n";
|
| }
|
| + AddToImplIncludes("bindings/v8/ExceptionMessages.h"); # FIXME: remove when rebase (after https://codereview.chromium.org/110423004/ lands)
|
| if ($leastNumMandatoryParams >= 1) {
|
| - if (!$hasExceptionState) {
|
| - AddToImplIncludes("bindings/v8/ExceptionMessages.h");
|
| - $header .= " ExceptionState exceptionState(ExceptionState::ConstructionContext, \"${interfaceName}\", info.Holder(), info.GetIsolate());\n";
|
| - $hasExceptionState = 1;
|
| - }
|
| - $code .= " if (UNLIKELY(info.Length() < $leastNumMandatoryParams)) {\n";
|
| - $code .= " exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments($leastNumMandatoryParams, info.Length()));\n";
|
| - $code .= " exceptionState.throwIfNeeded();\n";
|
| - $code .= " return;\n";
|
| - $code .= " }\n";
|
| - }
|
| - if ($hasExceptionState) {
|
| $code .= <<END;
|
| + ExceptionState exceptionState(ExceptionState::ConstructionContext, \"${interfaceName}\", info.Holder(), info.GetIsolate());
|
| + if (UNLIKELY(info.Length() < $leastNumMandatoryParams)) {
|
| + exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments($leastNumMandatoryParams, info.Length()));
|
| + exceptionState.throwIfNeeded();
|
| + return;
|
| + }
|
| exceptionState.throwTypeError(\"No matching constructor signature.\");
|
| exceptionState.throwIfNeeded();
|
| END
|
| } else {
|
| - AddToImplIncludes("bindings/v8/ExceptionMessages.h");
|
| $code .= <<END;
|
| throwTypeError(ExceptionMessages::failedToConstruct(\"${interfaceName}\", \"No matching constructor signature.\"), info.GetIsolate());
|
| END
|
| }
|
| $code .= "}\n\n";
|
| - $implementation{nameSpaceInternal}->add($header . $code);
|
| + $implementation{nameSpaceInternal}->add($code);
|
| }
|
|
|
| sub GenerateSingleConstructorCallback
|
|
|