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

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: Formatting 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
« no previous file with comments | « no previous file | Source/bindings/scripts/unstable/v8_interface.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 75e4ecac855c9c79e4c0948e9fc5c4db3b1bdfd3..9bb654cf472c912adaf6e8d9b1ccb7ad981e7e7b 100644
--- a/Source/bindings/scripts/code_generator_v8.pm
+++ b/Source/bindings/scripts/code_generator_v8.pm
@@ -2699,13 +2699,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;
@@ -2717,18 +2714,13 @@ END
$code .= " }\n";
}
if ($leastNumMandatoryParams >= 1) {
- if (!$hasExceptionState) {
- $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
@@ -2738,7 +2730,7 @@ END
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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698