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

Side by Side Diff: Source/bindings/scripts/v8_methods.py

Issue 1047993002: bindings: Add validation for enum Sequence or Array (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 raw_type=True, 216 raw_type=True,
217 used_as_variadic_argument=argument.is _variadic) 217 used_as_variadic_argument=argument.is _variadic)
218 return { 218 return {
219 'cpp_type': ( 219 'cpp_type': (
220 v8_types.cpp_template_type('Nullable', this_cpp_type) 220 v8_types.cpp_template_type('Nullable', this_cpp_type)
221 if idl_type.is_explicit_nullable and not argument.is_variadic 221 if idl_type.is_explicit_nullable and not argument.is_variadic
222 else this_cpp_type), 222 else this_cpp_type),
223 'cpp_value': this_cpp_value, 223 'cpp_value': this_cpp_value,
224 # FIXME: check that the default value's type is compatible with the argu ment's 224 # FIXME: check that the default value's type is compatible with the argu ment's
225 'set_default_value': set_default_value, 225 'set_default_value': set_default_value,
226 'enum_validation_expression': idl_type.enum_validation_expression, 226 'enum_values': idl_type.enum_values,
227 'handle': '%sHandle' % argument.name, 227 'handle': '%sHandle' % argument.name,
228 # FIXME: remove once [Default] removed and just use argument.default_val ue 228 # FIXME: remove once [Default] removed and just use argument.default_val ue
229 'has_default': 'Default' in extended_attributes or set_default_value, 229 'has_default': 'Default' in extended_attributes or set_default_value,
230 'has_type_checking_interface': has_type_checking_interface, 230 'has_type_checking_interface': has_type_checking_interface,
231 # Dictionary is special-cased, but arrays and sequences shouldn't be 231 # Dictionary is special-cased, but arrays and sequences shouldn't be
232 'idl_type': idl_type.base_type, 232 'idl_type': idl_type.base_type,
233 'idl_type_object': idl_type, 233 'idl_type_object': idl_type,
234 'index': index, 234 'index': index,
235 'is_callback_function': idl_type.is_callback_function, 235 'is_callback_function': idl_type.is_callback_function,
236 'is_callback_interface': idl_type.is_callback_interface, 236 'is_callback_interface': idl_type.is_callback_interface,
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 def method_returns_promise(method): 450 def method_returns_promise(method):
451 return method.idl_type and method.idl_type.name == 'Promise' 451 return method.idl_type and method.idl_type.name == 'Promise'
452 452
453 IdlOperation.returns_promise = property(method_returns_promise) 453 IdlOperation.returns_promise = property(method_returns_promise)
454 454
455 455
456 def argument_conversion_needs_exception_state(method, argument): 456 def argument_conversion_needs_exception_state(method, argument):
457 idl_type = argument.idl_type 457 idl_type = argument.idl_type
458 return (idl_type.v8_conversion_needs_exception_state or 458 return (idl_type.v8_conversion_needs_exception_state or
459 argument.is_variadic or 459 argument.is_variadic or
460 (method.returns_promise and (idl_type.is_string_type or 460 (method.returns_promise and idl_type.is_string_type))
461 idl_type.is_enum)))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698