Index: Source/bindings/tests/results/core/UnionTypesCore.cpp |
diff --git a/Source/bindings/tests/results/core/UnionTypesCore.cpp b/Source/bindings/tests/results/core/UnionTypesCore.cpp |
index 8e9f21d50bb45cd6fbb3e55540f599e07939b441..fbfaa3f8296033b0ea480debf327c3b3c140a0b2 100644 |
--- a/Source/bindings/tests/results/core/UnionTypesCore.cpp |
+++ b/Source/bindings/tests/results/core/UnionTypesCore.cpp |
@@ -758,8 +758,13 @@ String TestEnumOrDouble::getAsTestEnum() const |
void TestEnumOrDouble::setTestEnum(String value) |
{ |
ASSERT(isNull()); |
- String string = value; |
- if (!(string == "" || string == "EnumValue1" || string == "EnumValue2" || string == "EnumValue3")) { |
+ static const char* validValues[] = { |
+ "", |
+ "EnumValue1", |
+ "EnumValue2", |
+ "EnumValue3", |
+ }; |
+ if (!isValidEnum(value, validValues, WTF_ARRAY_LENGTH(validValues))) { |
ASSERT_NOT_REACHED(); |
return; |
} |
@@ -811,9 +816,14 @@ void V8TestEnumOrDouble::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Val |
V8StringResource<> cppValue = v8Value; |
if (!cppValue.prepare(exceptionState)) |
return; |
- String string = cppValue; |
- if (!(string == "" || string == "EnumValue1" || string == "EnumValue2" || string == "EnumValue3")) { |
- exceptionState.throwTypeError("'" + string + "' is not a valid enum value."); |
+ static const char* validValues[] = { |
+ "", |
+ "EnumValue1", |
+ "EnumValue2", |
+ "EnumValue3", |
+ }; |
+ if (!isValidEnum(cppValue, validValues, WTF_ARRAY_LENGTH(validValues))) { |
+ exceptionState.throwTypeError("'" + String(cppValue) + "' is not a valid enum value."); |
return; |
} |
impl.setTestEnum(cppValue); |