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

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

Issue 112303003: IDL compiler: [Constructor] overloading (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Better test case Created 7 years 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 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
« no previous file with comments | « no previous file | Source/bindings/scripts/unstable/v8_interface.py » ('j') | Source/bindings/scripts/unstable/v8_interface.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698