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

Unified Diff: Source/bindings/tests/results/V8TestInterfaceConstructor.cpp

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/tests/results/V8TestInterfaceConstructor.cpp
diff --git a/Source/bindings/tests/results/V8TestInterfaceConstructor.cpp b/Source/bindings/tests/results/V8TestInterfaceConstructor.cpp
index a3657e6dd7a368c3d7e3b0f558745de4064c91f6..e8319cc99772b6f3d75535d89f97cca6acdeb2ad 100644
--- a/Source/bindings/tests/results/V8TestInterfaceConstructor.cpp
+++ b/Source/bindings/tests/results/V8TestInterfaceConstructor.cpp
@@ -72,12 +72,22 @@ namespace TestInterfaceConstructorV8Internal {
template <typename T> void V8_USE(T) { }
-static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
+static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info)
{
- if (UNLIKELY(info.Length() < 5)) {
- throwTypeError(ExceptionMessages::failedToExecute("Constructor", "TestInterfaceConstructor", ExceptionMessages::notEnoughArguments(5, info.Length())), info.GetIsolate());
+ ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInterfaceConstructor", info.Holder(), info.GetIsolate());
+ ExecutionContext* context = getExecutionContext();
+ Document& document = *toDocument(getExecutionContext());
+ RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::create(context, document, exceptionState);
+ v8::Handle<v8::Object> wrapper = info.Holder();
+ if (exceptionState.throwIfNeeded())
return;
- }
+
+ V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor>(impl.release(), &V8TestInterfaceConstructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Dependent);
+ v8SetReturnValue(info, wrapper);
+}
+
+static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInterfaceConstructor", info.Holder(), info.GetIsolate());
V8TRYCATCH_VOID(double, doubleArg, static_cast<double>(info[0]->NumberValue()));
V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[1]);
@@ -104,6 +114,19 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
v8SetReturnValue(info, wrapper);
}
+static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ if (((info.Length() == 0))) {
+ TestInterfaceConstructorV8Internal::constructor1(info);
+ return;
+ }
+ if (((info.Length() == 5) && (V8TestInterfaceEmpty::hasInstance(info[2], info.GetIsolate(), worldType(info.GetIsolate()))) && (info[4]->IsArray())) || ((info.Length() == 6) && (V8TestInterfaceEmpty::hasInstance(info[2], info.GetIsolate(), worldType(info.GetIsolate()))) && (info[4]->IsArray()))) {
+ TestInterfaceConstructorV8Internal::constructor2(info);
+ return;
+ }
+ throwTypeError(ExceptionMessages::failedToConstruct("TestInterfaceConstructor", "No matching constructor signature."), info.GetIsolate());
+}
+
} // namespace TestInterfaceConstructorV8Internal
void V8TestInterfaceConstructor::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
@@ -134,7 +157,7 @@ static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceConstructorTempl
0, 0,
isolate, currentWorldType);
functionTemplate->SetCallHandler(V8TestInterfaceConstructor::constructorCallback);
- functionTemplate->SetLength(5);
+ functionTemplate->SetLength(0);
v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTemplate->InstanceTemplate();
v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTemplate->PrototypeTemplate();

Powered by Google App Engine
This is Rietveld 408576698