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

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

Issue 337343002: IDL: make optional arguments (without default) explicit sometimes Base URL: https://chromium.googlesource.com/chromium/blink.git@idl-default-arguments-next
Patch Set: Created 6 years, 4 months 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/V8TestInterfaceConstructor2.cpp
diff --git a/Source/bindings/tests/results/V8TestInterfaceConstructor2.cpp b/Source/bindings/tests/results/V8TestInterfaceConstructor2.cpp
index 6077e0bfa04f04d67923cbf6d3b64fc582c6f468..4018011586f9be87d24ce549ef3b6c30b6a97dc4 100644
--- a/Source/bindings/tests/results/V8TestInterfaceConstructor2.cpp
+++ b/Source/bindings/tests/results/V8TestInterfaceConstructor2.cpp
@@ -9,6 +9,7 @@
#include "bindings/core/v8/Dictionary.h"
#include "bindings/core/v8/ExceptionState.h"
+#include "bindings/core/v8/Optional.h"
#include "bindings/core/v8/V8DOMConfiguration.h"
#include "bindings/core/v8/V8HiddenValue.h"
#include "bindings/core/v8/V8ObjectConstructor.h"
@@ -81,36 +82,44 @@ static void constructor3(const v8::FunctionCallbackInfo<v8::Value>& info)
TestInterfaceEmpty* testInterfaceEmptyArg;
int longArg;
V8StringResource<> defaultUndefinedOptionalStringArg;
+ bool defaultUndefinedOptionalStringArgMissing = false;
V8StringResource<> defaultNullStringOptionalStringArg;
Dictionary defaultUndefinedOptionalDictionaryArg;
+ bool defaultUndefinedOptionalDictionaryArgMissing = false;
V8StringResource<> optionalStringArg;
+ bool optionalStringArgMissing = false;
{
v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
TONATIVE_VOID_INTERNAL(testInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(longArg, toInt32(info[1], exceptionState), exceptionState);
- TOSTRING_VOID_INTERNAL(defaultUndefinedOptionalStringArg, info[2]);
+ if (!info[2]->IsUndefined()) {
+ TOSTRING_VOID_INTERNAL(defaultUndefinedOptionalStringArg, info[2]);
+ } else {
+ defaultUndefinedOptionalStringArgMissing = true;
+ }
if (!info[3]->IsUndefined()) {
TOSTRING_VOID_INTERNAL(defaultNullStringOptionalStringArg, info[3]);
} else {
defaultNullStringOptionalStringArg = nullptr;
}
- TONATIVE_VOID_INTERNAL(defaultUndefinedOptionalDictionaryArg, Dictionary(info[4], info.GetIsolate()));
- if (!defaultUndefinedOptionalDictionaryArg.isUndefinedOrNull() && !defaultUndefinedOptionalDictionaryArg.isObject()) {
- exceptionState.throwTypeError("parameter 5 ('defaultUndefinedOptionalDictionaryArg') is not an object.");
- exceptionState.throwIfNeeded();
- return;
+ if (!info[4]->IsUndefined()) {
+ TONATIVE_VOID_INTERNAL(defaultUndefinedOptionalDictionaryArg, Dictionary(info[4], info.GetIsolate()));
+ if (!defaultUndefinedOptionalDictionaryArg.isUndefinedOrNull() && !defaultUndefinedOptionalDictionaryArg.isObject()) {
+ exceptionState.throwTypeError("parameter 5 ('defaultUndefinedOptionalDictionaryArg') is not an object.");
+ exceptionState.throwIfNeeded();
+ return;
+ }
+ } else {
+ defaultUndefinedOptionalDictionaryArgMissing = true;
}
- if (UNLIKELY(info.Length() <= 5)) {
- RefPtr<TestInterfaceConstructor2> impl = TestInterfaceConstructor2::create(testInterfaceEmptyArg, longArg, defaultUndefinedOptionalStringArg, defaultNullStringOptionalStringArg, defaultUndefinedOptionalDictionaryArg);
- v8::Handle<v8::Object> wrapper = info.Holder();
- V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor2>(impl.release(), &V8TestInterfaceConstructor2::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Independent);
- v8SetReturnValue(info, wrapper);
- return;
+ if (!info[5]->IsUndefined()) {
+ TOSTRING_VOID_INTERNAL(optionalStringArg, info[5]);
+ } else {
+ optionalStringArgMissing = true;
}
- TOSTRING_VOID_INTERNAL(optionalStringArg, info[5]);
}
- RefPtr<TestInterfaceConstructor2> impl = TestInterfaceConstructor2::create(testInterfaceEmptyArg, longArg, defaultUndefinedOptionalStringArg, defaultNullStringOptionalStringArg, defaultUndefinedOptionalDictionaryArg, optionalStringArg);
+ RefPtr<TestInterfaceConstructor2> impl = TestInterfaceConstructor2::create(testInterfaceEmptyArg, longArg, Optional<V8StringResource<> >(defaultUndefinedOptionalStringArg, defaultUndefinedOptionalStringArgMissing), defaultNullStringOptionalStringArg, Optional<Dictionary>(defaultUndefinedOptionalDictionaryArg, defaultUndefinedOptionalDictionaryArgMissing), Optional<V8StringResource<> >(optionalStringArg, optionalStringArgMissing));
v8::Handle<v8::Object> wrapper = info.Holder();
V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor2>(impl.release(), &V8TestInterfaceConstructor2::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Independent);
v8SetReturnValue(info, wrapper);

Powered by Google App Engine
This is Rietveld 408576698