Chromium Code Reviews| Index: Source/bindings/templates/methods.cpp |
| diff --git a/Source/bindings/templates/methods.cpp b/Source/bindings/templates/methods.cpp |
| index e059c508cd6564ec2b09fb720ea19162e7d96fa0..4fcc64570ada842149ef196639f281cd0ec2e2ba 100644 |
| --- a/Source/bindings/templates/methods.cpp |
| +++ b/Source/bindings/templates/methods.cpp |
| @@ -1,4 +1,4 @@ |
| -{% from 'conversions.cpp' import v8_value_to_local_cpp_value %} |
| +{% from 'conversions.cpp' import declare_enum_validation_variable, v8_value_to_local_cpp_value %} |
| {##############################################################################} |
| @@ -196,12 +196,12 @@ if (!{{argument.name}}{% if argument.is_nullable %} && !isUndefinedOrNull(info[{ |
| {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' % |
| (argument.index + 1, argument.idl_type)) | indent}} |
| } |
| -{% elif argument.enum_validation_expression %} |
| +{% elif argument.enum_values %} |
| {# Invalid enum values: http://www.w3.org/TR/WebIDL/#idl-enums #} |
| -String string = {{argument.name}}; |
| -if (!({{argument.enum_validation_expression}})) { |
| +{{declare_enum_validation_variable(argument.enum_values)}} |
| +if (!isValidEnum({{argument.name}}, validValues, {{argument.enum_values|length}})) { |
|
haraken
2015/03/31 06:11:17
Space around '|'?
|
| {{throw_type_error(method, |
| - '"parameter %s (\'" + string + "\') is not a valid enum value."' % |
| + '"parameter %s is not a valid enum value."' % |
| (argument.index + 1)) | indent}} |
| } |
| {% elif argument.idl_type == 'Promise' %} |