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

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

Issue 470063003: IDL: Use IdlArrayOrSequenceType for array/sequence IDL types (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@idl-extend-IdlTypeBase
Patch Set: simplify cpp_type_has_null_value() Created 6 years, 4 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
« no previous file with comments | « Source/bindings/scripts/v8_dictionary.py ('k') | Source/bindings/scripts/v8_types.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES = frozenset([ 47 CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES = frozenset([
48 'DoNotCheckSecurity', 48 'DoNotCheckSecurity',
49 'DoNotCheckSignature', 49 'DoNotCheckSignature',
50 'NotEnumerable', 50 'NotEnumerable',
51 'Unforgeable', 51 'Unforgeable',
52 ]) 52 ])
53 53
54 54
55 def argument_needs_try_catch(argument, return_promise): 55 def argument_needs_try_catch(argument, return_promise):
56 idl_type = argument.idl_type 56 idl_type = argument.idl_type
57 base_type = not idl_type.native_array_element_type and idl_type.base_type 57 base_type = idl_type.base_type
58 58
59 return not ( 59 return not (
60 # These cases are handled by separate code paths in the 60 # These cases are handled by separate code paths in the
61 # generate_argument() macro in Source/bindings/templates/methods.cpp. 61 # generate_argument() macro in Source/bindings/templates/methods.cpp.
62 idl_type.is_callback_interface or 62 idl_type.is_callback_interface or
63 base_type == 'SerializedScriptValue' or 63 base_type == 'SerializedScriptValue' or
64 (argument.is_variadic and idl_type.is_wrapper_type) or 64 (argument.is_variadic and idl_type.is_wrapper_type) or
65 # String and enumeration arguments converted using one of the 65 # String and enumeration arguments converted using one of the
66 # TOSTRING_* macros except for _PROMISE variants in 66 # TOSTRING_* macros except for _PROMISE variants in
67 # Source/bindings/core/v8/V8BindingMacros.h don't use a v8::TryCatch. 67 # Source/bindings/core/v8/V8BindingMacros.h don't use a v8::TryCatch.
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 'has_default': 'Default' in extended_attributes or argument.default_valu e, 227 'has_default': 'Default' in extended_attributes or argument.default_valu e,
228 'has_type_checking_interface': 228 'has_type_checking_interface':
229 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface' ) or 229 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface' ) or
230 has_extended_attribute_value(method, 'TypeChecking', 'Interface')) and 230 has_extended_attribute_value(method, 'TypeChecking', 'Interface')) and
231 idl_type.is_wrapper_type, 231 idl_type.is_wrapper_type,
232 'has_type_checking_unrestricted': 232 'has_type_checking_unrestricted':
233 (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestrict ed') or 233 (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestrict ed') or
234 has_extended_attribute_value(method, 'TypeChecking', 'Unrestricted' )) and 234 has_extended_attribute_value(method, 'TypeChecking', 'Unrestricted' )) and
235 idl_type.name in ('Float', 'Double'), 235 idl_type.name in ('Float', 'Double'),
236 # Dictionary is special-cased, but arrays and sequences shouldn't be 236 # Dictionary is special-cased, but arrays and sequences shouldn't be
237 'idl_type': not idl_type.native_array_element_type and idl_type.base_typ e, 237 'idl_type': idl_type.base_type,
238 'idl_type_object': idl_type, 238 'idl_type_object': idl_type,
239 'index': index, 239 'index': index,
240 'is_clamp': 'Clamp' in extended_attributes, 240 'is_clamp': 'Clamp' in extended_attributes,
241 'is_callback_interface': idl_type.is_callback_interface, 241 'is_callback_interface': idl_type.is_callback_interface,
242 'is_nullable': idl_type.is_nullable, 242 'is_nullable': idl_type.is_nullable,
243 'is_optional': argument.is_optional, 243 'is_optional': argument.is_optional,
244 'is_variadic_wrapper_type': is_variadic_wrapper_type, 244 'is_variadic_wrapper_type': is_variadic_wrapper_type,
245 'is_wrapper_type': idl_type.is_wrapper_type, 245 'is_wrapper_type': idl_type.is_wrapper_type,
246 'name': argument.name, 246 'name': argument.name,
247 'private_script_cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( 247 'private_script_cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value(
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 409
410 410
411 def argument_default_cpp_value(argument): 411 def argument_default_cpp_value(argument):
412 if not argument.default_value: 412 if not argument.default_value:
413 return None 413 return None
414 return argument.idl_type.literal_cpp_value(argument.default_value) 414 return argument.idl_type.literal_cpp_value(argument.default_value)
415 415
416 IdlTypeBase.union_arguments = None 416 IdlTypeBase.union_arguments = None
417 IdlUnionType.union_arguments = property(union_arguments) 417 IdlUnionType.union_arguments = property(union_arguments)
418 IdlArgument.default_cpp_value = property(argument_default_cpp_value) 418 IdlArgument.default_cpp_value = property(argument_default_cpp_value)
OLDNEW
« no previous file with comments | « Source/bindings/scripts/v8_dictionary.py ('k') | Source/bindings/scripts/v8_types.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698