Chromium Code Reviews| Index: Source/bindings/templates/dictionary_v8.cpp |
| diff --git a/Source/bindings/templates/dictionary_v8.cpp b/Source/bindings/templates/dictionary_v8.cpp |
| index c6b6d1343a7b3922a93e49f78d18884ee6347a01..f5a012eb809f5f00f00984ecbdf847fb925f03b0 100644 |
| --- a/Source/bindings/templates/dictionary_v8.cpp |
| +++ b/Source/bindings/templates/dictionary_v8.cpp |
| @@ -1,3 +1,4 @@ |
| +{% from 'conversions.cpp' import declare_enum_validation_variable %} |
| // Copyright 2014 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| @@ -62,10 +63,10 @@ void {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, {{ |
| return; |
| } |
| {% endif %} |
| - {% if member.enum_validation_expression %} |
| - String string = {{member.name}}; |
| - if (!({{member.enum_validation_expression}})) { |
| - exceptionState.throwTypeError("member {{member.name}} ('" + string + "') is not a valid enum value."); |
| + {% if member.enum_values %} |
| + {{declare_enum_validation_variable(member.enum_values) | indent(8)}} |
| + if (!isValidEnum({{member.name}}, validValues, {{member.enum_values|length}})) { |
|
haraken
2015/03/31 06:11:17
Space around '|'?
|
| + exceptionState.throwTypeError("member {{member.name}} is not a valid enum value."); |
| return; |
| } |
| {% elif member.is_object %} |