Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (206973 => 206974)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-10-10 00:45:20 UTC (rev 206973)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-10-10 01:16:05 UTC (rev 206974)
@@ -475,222 +475,191 @@
throwTypeError(&state, throwScope);
return Nullopt;
}
+ TestObj::Dictionary result;
JSValue anyTypedefValueValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "anyTypedefValue"));
- JSC::JSValue anyTypedefValue;
if (!anyTypedefValueValue.isUndefined()) {
- anyTypedefValue = convert<JSC::JSValue>(state, anyTypedefValueValue);
+ result.anyTypedefValue = convert<JSC::JSValue>(state, anyTypedefValueValue);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
} else
- anyTypedefValue = jsUndefined();
+ result.anyTypedefValue = jsUndefined();
JSValue anyValueValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "anyValue"));
- JSC::JSValue anyValue;
if (!anyValueValue.isUndefined()) {
- anyValue = convert<JSC::JSValue>(state, anyValueValue);
+ result.anyValue = convert<JSC::JSValue>(state, anyValueValue);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
} else
- anyValue = jsUndefined();
+ result.anyValue = jsUndefined();
JSValue anyValueWithNullDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "anyValueWithNullDefault"));
- JSC::JSValue anyValueWithNullDefault;
if (!anyValueWithNullDefaultValue.isUndefined()) {
- anyValueWithNullDefault = convert<JSC::JSValue>(state, anyValueWithNullDefaultValue);
+ result.anyValueWithNullDefault = convert<JSC::JSValue>(state, anyValueWithNullDefaultValue);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
} else
- anyValueWithNullDefault = jsNull();
+ result.anyValueWithNullDefault = jsNull();
JSValue booleanWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "booleanWithDefault"));
- bool booleanWithDefault;
if (!booleanWithDefaultValue.isUndefined()) {
- booleanWithDefault = convert<bool>(state, booleanWithDefaultValue);
+ result.booleanWithDefault = convert<bool>(state, booleanWithDefaultValue);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
} else
- booleanWithDefault = false;
+ result.booleanWithDefault = false;
JSValue booleanWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "booleanWithoutDefault"));
- Converter<bool>::OptionalValue booleanWithoutDefault;
if (!booleanWithoutDefaultValue.isUndefined()) {
- booleanWithoutDefault = convert<bool>(state, booleanWithoutDefaultValue);
+ result.booleanWithoutDefault = convert<bool>(state, booleanWithoutDefaultValue);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
JSValue dictionaryMemberValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "dictionaryMember"));
- Converter<TestObj::DictionaryThatShouldTolerateNull>::OptionalValue dictionaryMember;
if (!dictionaryMemberValue.isUndefined()) {
- dictionaryMember = convertDictionary<TestObj::DictionaryThatShouldTolerateNull>(state, dictionaryMemberValue);
+ Optional<TestObj::DictionaryThatShouldTolerateNull> dictionaryMember = convertDictionary<TestObj::DictionaryThatShouldTolerateNull>(state, dictionaryMemberValue).value();
RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ result.dictionaryMember = dictionaryMember.value();
}
JSValue enumerationValueWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "enumerationValueWithDefault"));
- TestObj::EnumType enumerationValueWithDefault;
if (!enumerationValueWithDefaultValue.isUndefined()) {
- enumerationValueWithDefault = convert<TestObj::EnumType>(state, enumerationValueWithDefaultValue);
+ result.enumerationValueWithDefault = convert<TestObj::EnumType>(state, enumerationValueWithDefaultValue);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
} else
- enumerationValueWithDefault = TestObj::EnumType::EnumValue1;
+ result.enumerationValueWithDefault = TestObj::EnumType::EnumValue1;
JSValue enumerationValueWithEmptyStringDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "enumerationValueWithEmptyStringDefault"));
- TestObj::EnumType enumerationValueWithEmptyStringDefault;
if (!enumerationValueWithEmptyStringDefaultValue.isUndefined()) {
- enumerationValueWithEmptyStringDefault = convert<TestObj::EnumType>(state, enumerationValueWithEmptyStringDefaultValue);
+ result.enumerationValueWithEmptyStringDefault = convert<TestObj::EnumType>(state, enumerationValueWithEmptyStringDefaultValue);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
} else
- enumerationValueWithEmptyStringDefault = TestObj::EnumType::EmptyString;
+ result.enumerationValueWithEmptyStringDefault = TestObj::EnumType::EmptyString;
JSValue enumerationValueWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "enumerationValueWithoutDefault"));
- Converter<TestObj::EnumType>::OptionalValue enumerationValueWithoutDefault;
if (!enumerationValueWithoutDefaultValue.isUndefined()) {
- enumerationValueWithoutDefault = convert<TestObj::EnumType>(state, enumerationValueWithoutDefaultValue);
+ result.enumerationValueWithoutDefault = convert<TestObj::EnumType>(state, enumerationValueWithoutDefaultValue);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
JSValue integerValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "integer"));
- Converter<int32_t>::OptionalValue integer;
if (!integerValue.isUndefined()) {
- integer = convert<int32_t>(state, integerValue, NormalConversion);
+ result.integer = convert<int32_t>(state, integerValue, NormalConversion);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
JSValue integerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "integerWithDefault"));
- int32_t integerWithDefault;
if (!integerWithDefaultValue.isUndefined()) {
- integerWithDefault = convert<int32_t>(state, integerWithDefaultValue, NormalConversion);
+ result.integerWithDefault = convert<int32_t>(state, integerWithDefaultValue, NormalConversion);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
} else
- integerWithDefault = 0;
+ result.integerWithDefault = 0;
JSValue largeIntegerValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "largeInteger"));
- Converter<int64_t>::OptionalValue largeInteger;
if (!largeIntegerValue.isUndefined()) {
- largeInteger = convert<int64_t>(state, largeIntegerValue, NormalConversion);
+ result.largeInteger = convert<int64_t>(state, largeIntegerValue, NormalConversion);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
JSValue largeIntegerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "largeIntegerWithDefault"));
- int64_t largeIntegerWithDefault;
if (!largeIntegerWithDefaultValue.isUndefined()) {
- largeIntegerWithDefault = convert<int64_t>(state, largeIntegerWithDefaultValue, NormalConversion);
+ result.largeIntegerWithDefault = convert<int64_t>(state, largeIntegerWithDefaultValue, NormalConversion);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
} else
- largeIntegerWithDefault = 0;
+ result.largeIntegerWithDefault = 0;
JSValue nullableNodeValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "nullableNode"));
- Node* nullableNode;
if (!nullableNodeValue.isUndefined()) {
- nullableNode = convertWrapperType<Node, JSNode>(state, nullableNodeValue, IsNullable::Yes);
+ result.nullableNode = convertWrapperType<Node, JSNode>(state, nullableNodeValue, IsNullable::Yes);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
} else
- nullableNode = nullptr;
+ result.nullableNode = nullptr;
JSValue restrictedDoubleValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "restrictedDouble"));
- Converter<double>::OptionalValue restrictedDouble;
if (!restrictedDoubleValue.isUndefined()) {
- restrictedDouble = convert<double>(state, restrictedDoubleValue, ShouldAllowNonFinite::No);
+ result.restrictedDouble = convert<double>(state, restrictedDoubleValue, ShouldAllowNonFinite::No);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
JSValue restrictedDoubleWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "restrictedDoubleWithDefault"));
- double restrictedDoubleWithDefault;
if (!restrictedDoubleWithDefaultValue.isUndefined()) {
- restrictedDoubleWithDefault = convert<double>(state, restrictedDoubleWithDefaultValue, ShouldAllowNonFinite::No);
+ result.restrictedDoubleWithDefault = convert<double>(state, restrictedDoubleWithDefaultValue, ShouldAllowNonFinite::No);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
} else
- restrictedDoubleWithDefault = 0;
+ result.restrictedDoubleWithDefault = 0;
JSValue restrictedFloatValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "restrictedFloat"));
- Converter<float>::OptionalValue restrictedFloat;
if (!restrictedFloatValue.isUndefined()) {
- restrictedFloat = convert<float>(state, restrictedFloatValue, ShouldAllowNonFinite::No);
+ result.restrictedFloat = convert<float>(state, restrictedFloatValue, ShouldAllowNonFinite::No);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
JSValue restrictedFloatWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "restrictedFloatWithDefault"));
- float restrictedFloatWithDefault;
if (!restrictedFloatWithDefaultValue.isUndefined()) {
- restrictedFloatWithDefault = convert<float>(state, restrictedFloatWithDefaultValue, ShouldAllowNonFinite::No);
+ result.restrictedFloatWithDefault = convert<float>(state, restrictedFloatWithDefaultValue, ShouldAllowNonFinite::No);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
} else
- restrictedFloatWithDefault = 0;
+ result.restrictedFloatWithDefault = 0;
JSValue sequenceOfStringsValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "sequenceOfStrings"));
- Converter<Vector<String>>::OptionalValue sequenceOfStrings;
if (!sequenceOfStringsValue.isUndefined()) {
- sequenceOfStrings = convert<Vector<String>>(state, sequenceOfStringsValue);
+ result.sequenceOfStrings = convert<Vector<String>>(state, sequenceOfStringsValue);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
JSValue smallIntegerClampedValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "smallIntegerClamped"));
- Converter<int8_t>::OptionalValue smallIntegerClamped;
if (!smallIntegerClampedValue.isUndefined()) {
- smallIntegerClamped = convert<int8_t>(state, smallIntegerClampedValue, Clamp);
+ result.smallIntegerClamped = convert<int8_t>(state, smallIntegerClampedValue, Clamp);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
JSValue smallIntegerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "smallIntegerWithDefault"));
- Converter<int8_t>::OptionalValue smallIntegerWithDefault;
if (!smallIntegerWithDefaultValue.isUndefined()) {
- smallIntegerWithDefault = convert<int8_t>(state, smallIntegerWithDefaultValue, NormalConversion);
+ result.smallIntegerWithDefault = convert<int8_t>(state, smallIntegerWithDefaultValue, NormalConversion);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
JSValue smallUnsignedIntegerEnforcedRangeValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "smallUnsignedIntegerEnforcedRange"));
- Converter<uint8_t>::OptionalValue smallUnsignedIntegerEnforcedRange;
if (!smallUnsignedIntegerEnforcedRangeValue.isUndefined()) {
- smallUnsignedIntegerEnforcedRange = convert<uint8_t>(state, smallUnsignedIntegerEnforcedRangeValue, EnforceRange);
+ result.smallUnsignedIntegerEnforcedRange = convert<uint8_t>(state, smallUnsignedIntegerEnforcedRangeValue, EnforceRange);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
JSValue smallUnsignedIntegerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "smallUnsignedIntegerWithDefault"));
- uint8_t smallUnsignedIntegerWithDefault;
if (!smallUnsignedIntegerWithDefaultValue.isUndefined()) {
- smallUnsignedIntegerWithDefault = convert<uint8_t>(state, smallUnsignedIntegerWithDefaultValue, NormalConversion);
+ result.smallUnsignedIntegerWithDefault = convert<uint8_t>(state, smallUnsignedIntegerWithDefaultValue, NormalConversion);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
} else
- smallUnsignedIntegerWithDefault = 0;
+ result.smallUnsignedIntegerWithDefault = 0;
JSValue stringWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "stringWithDefault"));
- String stringWithDefault;
if (!stringWithDefaultValue.isUndefined()) {
- stringWithDefault = convert<String>(state, stringWithDefaultValue);
+ result.stringWithDefault = convert<String>(state, stringWithDefaultValue);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
} else
- stringWithDefault = "defaultString";
+ result.stringWithDefault = "defaultString";
JSValue stringWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "stringWithoutDefault"));
- Converter<String>::OptionalValue stringWithoutDefault;
if (!stringWithoutDefaultValue.isUndefined()) {
- stringWithoutDefault = convert<String>(state, stringWithoutDefaultValue);
+ result.stringWithoutDefault = convert<String>(state, stringWithoutDefaultValue);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
JSValue unrestrictedDoubleValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unrestrictedDouble"));
- Converter<double>::OptionalValue unrestrictedDouble;
if (!unrestrictedDoubleValue.isUndefined()) {
- unrestrictedDouble = convert<double>(state, unrestrictedDoubleValue, ShouldAllowNonFinite::Yes);
+ result.unrestrictedDouble = convert<double>(state, unrestrictedDoubleValue, ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
JSValue unrestrictedDoubleWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unrestrictedDoubleWithDefault"));
- double unrestrictedDoubleWithDefault;
if (!unrestrictedDoubleWithDefaultValue.isUndefined()) {
- unrestrictedDoubleWithDefault = convert<double>(state, unrestrictedDoubleWithDefaultValue, ShouldAllowNonFinite::Yes);
+ result.unrestrictedDoubleWithDefault = convert<double>(state, unrestrictedDoubleWithDefaultValue, ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
} else
- unrestrictedDoubleWithDefault = 0;
+ result.unrestrictedDoubleWithDefault = 0;
JSValue unrestrictedFloatValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unrestrictedFloat"));
- Converter<float>::OptionalValue unrestrictedFloat;
if (!unrestrictedFloatValue.isUndefined()) {
- unrestrictedFloat = convert<float>(state, unrestrictedFloatValue, ShouldAllowNonFinite::Yes);
+ result.unrestrictedFloat = convert<float>(state, unrestrictedFloatValue, ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
JSValue unrestrictedFloatWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unrestrictedFloatWithDefault"));
- float unrestrictedFloatWithDefault;
if (!unrestrictedFloatWithDefaultValue.isUndefined()) {
- unrestrictedFloatWithDefault = convert<float>(state, unrestrictedFloatWithDefaultValue, ShouldAllowNonFinite::Yes);
+ result.unrestrictedFloatWithDefault = convert<float>(state, unrestrictedFloatWithDefaultValue, ShouldAllowNonFinite::Yes);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
} else
- unrestrictedFloatWithDefault = 0;
+ result.unrestrictedFloatWithDefault = 0;
JSValue unsignedIntegerValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unsignedInteger"));
- Converter<uint32_t>::OptionalValue unsignedInteger;
if (!unsignedIntegerValue.isUndefined()) {
- unsignedInteger = convert<uint32_t>(state, unsignedIntegerValue, NormalConversion);
+ result.unsignedInteger = convert<uint32_t>(state, unsignedIntegerValue, NormalConversion);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
JSValue unsignedIntegerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unsignedIntegerWithDefault"));
- uint32_t unsignedIntegerWithDefault;
if (!unsignedIntegerWithDefaultValue.isUndefined()) {
- unsignedIntegerWithDefault = convert<uint32_t>(state, unsignedIntegerWithDefaultValue, NormalConversion);
+ result.unsignedIntegerWithDefault = convert<uint32_t>(state, unsignedIntegerWithDefaultValue, NormalConversion);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
} else
- unsignedIntegerWithDefault = 0;
+ result.unsignedIntegerWithDefault = 0;
JSValue unsignedLargeIntegerValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unsignedLargeInteger"));
- Converter<uint64_t>::OptionalValue unsignedLargeInteger;
if (!unsignedLargeIntegerValue.isUndefined()) {
- unsignedLargeInteger = convert<uint64_t>(state, unsignedLargeIntegerValue, NormalConversion);
+ result.unsignedLargeInteger = convert<uint64_t>(state, unsignedLargeIntegerValue, NormalConversion);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
JSValue unsignedLargeIntegerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unsignedLargeIntegerWithDefault"));
- uint64_t unsignedLargeIntegerWithDefault;
if (!unsignedLargeIntegerWithDefaultValue.isUndefined()) {
- unsignedLargeIntegerWithDefault = convert<uint64_t>(state, unsignedLargeIntegerWithDefaultValue, NormalConversion);
+ result.unsignedLargeIntegerWithDefault = convert<uint64_t>(state, unsignedLargeIntegerWithDefaultValue, NormalConversion);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
} else
- unsignedLargeIntegerWithDefault = 0;
- return TestObj::Dictionary { WTFMove(enumerationValueWithoutDefault), WTFMove(enumerationValueWithDefault), WTFMove(enumerationValueWithEmptyStringDefault), WTFMove(stringWithDefault), WTFMove(stringWithoutDefault), WTFMove(booleanWithDefault), WTFMove(booleanWithoutDefault), WTFMove(sequenceOfStrings), WTFMove(restrictedDouble), WTFMove(unrestrictedDouble), WTFMove(restrictedDoubleWithDefault), WTFMove(unrestrictedDoubleWithDefault), WTFMove(restrictedFloat), WTFMove(unrestrictedFloat), WTFMove(restrictedFloatWithDefault), WTFMove(unrestrictedFloatWithDefault), WTFMove(smallIntegerClamped), WTFMove(smallIntegerWithDefault), WTFMove(smallUnsignedIntegerEnforcedRange), WTFMove(smallUnsignedIntegerWithDefault), WTFMove(integer), WTFMove(integerWithDefault), WTFMove(unsignedInteger), WTFMove(unsignedIntegerWithDefault), WTFMove(largeInteger), WTFMove(largeIntegerWithDefault), WTFMove(unsignedLargeInteger), WTFMove(unsignedLargeIntegerWithDefault), WTFMove(nullableNode), WTF
Move(anyValue), WTFMove(anyValueWithNullDefault), WTFMove(anyTypedefValue), dictionaryMember.value() };
+ result.unsignedLargeIntegerWithDefault = 0;
+ return WTFMove(result);
}
template<> Optional<TestObj::DictionaryThatShouldNotTolerateNull> convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>(ExecState& state, JSValue value)
@@ -707,16 +676,15 @@
throwTypeError(&state, throwScope);
return Nullopt;
}
+ TestObj::DictionaryThatShouldNotTolerateNull result;
JSValue booleanWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "booleanWithoutDefault"));
- Converter<bool>::OptionalValue booleanWithoutDefault;
if (!booleanWithoutDefaultValue.isUndefined()) {
- booleanWithoutDefault = convert<bool>(state, booleanWithoutDefaultValue);
+ result.booleanWithoutDefault = convert<bool>(state, booleanWithoutDefaultValue);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
JSValue nonNullableNodeValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "nonNullableNode"));
- Node* nonNullableNode;
if (!nonNullableNodeValue.isUndefined()) {
- nonNullableNode = convertWrapperType<Node, JSNode>(state, nonNullableNodeValue, IsNullable::No);
+ result.nonNullableNode = convertWrapperType<Node, JSNode>(state, nonNullableNodeValue, IsNullable::No);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
} else {
throwTypeError(&state, throwScope);
@@ -723,24 +691,23 @@
return Nullopt;
}
JSValue requiredDictionaryMemberValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "requiredDictionaryMember"));
- TestObj::Dictionary requiredDictionaryMember;
if (!requiredDictionaryMemberValue.isUndefined()) {
- requiredDictionaryMember = convertDictionary<TestObj::Dictionary>(state, requiredDictionaryMemberValue);
+ Optional<TestObj::Dictionary> requiredDictionaryMember = convertDictionary<TestObj::Dictionary>(state, requiredDictionaryMemberValue).value();
RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ result.requiredDictionaryMember = requiredDictionaryMember.value();
} else {
throwTypeError(&state, throwScope);
return Nullopt;
}
JSValue requiredEnumerationValueValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "requiredEnumerationValue"));
- TestObj::EnumType requiredEnumerationValue;
if (!requiredEnumerationValueValue.isUndefined()) {
- requiredEnumerationValue = convert<TestObj::EnumType>(state, requiredEnumerationValueValue);
+ result.requiredEnumerationValue = convert<TestObj::EnumType>(state, requiredEnumerationValueValue);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
} else {
throwTypeError(&state, throwScope);
return Nullopt;
}
- return TestObj::DictionaryThatShouldNotTolerateNull { WTFMove(requiredEnumerationValue), WTFMove(booleanWithoutDefault), *nonNullableNode, requiredDictionaryMember.value() };
+ return WTFMove(result);
}
template<> Optional<TestObj::DictionaryThatShouldTolerateNull> convertDictionary<TestObj::DictionaryThatShouldTolerateNull>(ExecState& state, JSValue value)
@@ -757,19 +724,18 @@
throwTypeError(&state, throwScope);
return Nullopt;
}
+ TestObj::DictionaryThatShouldTolerateNull result;
JSValue booleanWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "booleanWithoutDefault"));
- Converter<bool>::OptionalValue booleanWithoutDefault;
if (!booleanWithoutDefaultValue.isUndefined()) {
- booleanWithoutDefault = convert<bool>(state, booleanWithoutDefaultValue);
+ result.booleanWithoutDefault = convert<bool>(state, booleanWithoutDefaultValue);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
JSValue enumerationValueValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "enumerationValue"));
- Converter<TestObj::EnumType>::OptionalValue enumerationValue;
if (!enumerationValueValue.isUndefined()) {
- enumerationValue = convert<TestObj::EnumType>(state, enumerationValueValue);
+ result.enumerationValue = convert<TestObj::EnumType>(state, enumerationValueValue);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
- return TestObj::DictionaryThatShouldTolerateNull { WTFMove(enumerationValue), WTFMove(booleanWithoutDefault) };
+ return WTFMove(result);
}
template<> Optional<AlternateDictionaryName> convertDictionary<AlternateDictionaryName>(ExecState& state, JSValue value)
@@ -786,19 +752,18 @@
throwTypeError(&state, throwScope);
return Nullopt;
}
+ AlternateDictionaryName result;
JSValue booleanWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "booleanWithoutDefault"));
- Converter<bool>::OptionalValue booleanWithoutDefault;
if (!booleanWithoutDefaultValue.isUndefined()) {
- booleanWithoutDefault = convert<bool>(state, booleanWithoutDefaultValue);
+ result.booleanWithoutDefault = convert<bool>(state, booleanWithoutDefaultValue);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
JSValue enumerationValueValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "enumerationValue"));
- Converter<TestObj::EnumType>::OptionalValue enumerationValue;
if (!enumerationValueValue.isUndefined()) {
- enumerationValue = convert<TestObj::EnumType>(state, enumerationValueValue);
+ result.enumerationValue = convert<TestObj::EnumType>(state, enumerationValueValue);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
- return AlternateDictionaryName { WTFMove(enumerationValue), WTFMove(booleanWithoutDefault) };
+ return WTFMove(result);
}
template<> Optional<TestObj::ParentDictionary> convertDictionary<TestObj::ParentDictionary>(ExecState& state, JSValue value)
@@ -815,19 +780,18 @@
throwTypeError(&state, throwScope);
return Nullopt;
}
+ TestObj::ParentDictionary result;
JSValue parentMember1Value = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "parentMember1"));
- Converter<bool>::OptionalValue parentMember1;
if (!parentMember1Value.isUndefined()) {
- parentMember1 = convert<bool>(state, parentMember1Value);
+ result.parentMember1 = convert<bool>(state, parentMember1Value);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
JSValue parentMember2Value = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "parentMember2"));
- Converter<bool>::OptionalValue parentMember2;
if (!parentMember2Value.isUndefined()) {
- parentMember2 = convert<bool>(state, parentMember2Value);
+ result.parentMember2 = convert<bool>(state, parentMember2Value);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
- return TestObj::ParentDictionary { WTFMove(parentMember2), WTFMove(parentMember1) };
+ return WTFMove(result);
}
template<> Optional<TestObj::ChildDictionary> convertDictionary<TestObj::ChildDictionary>(ExecState& state, JSValue value)
@@ -844,31 +808,28 @@
throwTypeError(&state, throwScope);
return Nullopt;
}
+ TestObj::ChildDictionary result;
JSValue parentMember1Value = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "parentMember1"));
- Converter<bool>::OptionalValue parentMember1;
if (!parentMember1Value.isUndefined()) {
- parentMember1 = convert<bool>(state, parentMember1Value);
+ result.parentMember1 = convert<bool>(state, parentMember1Value);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
JSValue parentMember2Value = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "parentMember2"));
- Converter<bool>::OptionalValue parentMember2;
if (!parentMember2Value.isUndefined()) {
- parentMember2 = convert<bool>(state, parentMember2Value);
+ result.parentMember2 = convert<bool>(state, parentMember2Value);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
JSValue childMember1Value = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "childMember1"));
- Converter<bool>::OptionalValue childMember1;
if (!childMember1Value.isUndefined()) {
- childMember1 = convert<bool>(state, childMember1Value);
+ result.childMember1 = convert<bool>(state, childMember1Value);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
JSValue childMember2Value = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "childMember2"));
- Converter<bool>::OptionalValue childMember2;
if (!childMember2Value.isUndefined()) {
- childMember2 = convert<bool>(state, childMember2Value);
+ result.childMember2 = convert<bool>(state, childMember2Value);
RETURN_IF_EXCEPTION(throwScope, Nullopt);
}
- return TestObj::ChildDictionary { WTFMove(parentMember2), WTFMove(parentMember1), WTFMove(childMember2), WTFMove(childMember1) };
+ return WTFMove(result);
}
// Functions