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

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

Issue 954723002: [bindings] Support is_explicit_nullable for method arguments. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review comments addressed! Created 5 years, 9 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
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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 has_extended_attribute_value(interface, 'TypeChecking', 'Unrestricted') or 205 has_extended_attribute_value(interface, 'TypeChecking', 'Unrestricted') or
206 has_extended_attribute_value(method, 'TypeChecking', 'Unrestricted')) 206 has_extended_attribute_value(method, 'TypeChecking', 'Unrestricted'))
207 207
208 if ('ImplementedInPrivateScript' in extended_attributes and 208 if ('ImplementedInPrivateScript' in extended_attributes and
209 not idl_type.is_wrapper_type and 209 not idl_type.is_wrapper_type and
210 not idl_type.is_basic_type): 210 not idl_type.is_basic_type):
211 raise Exception('Private scripts supports only primitive types and DOM w rappers.') 211 raise Exception('Private scripts supports only primitive types and DOM w rappers.')
212 212
213 set_default_value = argument.set_default_value 213 set_default_value = argument.set_default_value
214 return { 214 return {
215 'cpp_type': idl_type.cpp_type_args(extended_attributes=extended_attribut es, 215 'cpp_type': (
216 raw_type=True, 216 v8_types.cpp_template_type('Nullable', idl_type.cpp_type)
217 used_as_variadic_argument=argument.is _variadic), 217 if idl_type.is_explicit_nullable
218 else idl_type.cpp_type_args(
Jens Widell 2015/03/02 07:53:13 I think it would be better to move this call to id
219 extended_attributes=extended_attributes,
220 raw_type=True,
221 used_as_variadic_argument=argument.is_variadic)),
218 'cpp_value': this_cpp_value, 222 'cpp_value': this_cpp_value,
219 # FIXME: check that the default value's type is compatible with the argu ment's 223 # FIXME: check that the default value's type is compatible with the argu ment's
220 'set_default_value': set_default_value, 224 'set_default_value': set_default_value,
221 'enum_validation_expression': idl_type.enum_validation_expression, 225 'enum_validation_expression': idl_type.enum_validation_expression,
222 'handle': '%sHandle' % argument.name, 226 'handle': '%sHandle' % argument.name,
223 # FIXME: remove once [Default] removed and just use argument.default_val ue 227 # FIXME: remove once [Default] removed and just use argument.default_val ue
224 'has_default': 'Default' in extended_attributes or set_default_value, 228 'has_default': 'Default' in extended_attributes or set_default_value,
225 'has_type_checking_interface': type_checking_interface, 229 'has_type_checking_interface': type_checking_interface,
226 # Dictionary is special-cased, but arrays and sequences shouldn't be 230 # Dictionary is special-cased, but arrays and sequences shouldn't be
227 'idl_type': idl_type.base_type, 231 'idl_type': idl_type.base_type,
228 'idl_type_object': idl_type, 232 'idl_type_object': idl_type,
229 'index': index, 233 'index': index,
230 'is_callback_function': idl_type.is_callback_function, 234 'is_callback_function': idl_type.is_callback_function,
231 'is_callback_interface': idl_type.is_callback_interface, 235 'is_callback_interface': idl_type.is_callback_interface,
232 # FIXME: Remove generic 'Dictionary' special-casing 236 # FIXME: Remove generic 'Dictionary' special-casing
233 'is_dictionary': idl_type.is_dictionary or idl_type.base_type == 'Dictio nary', 237 'is_dictionary': idl_type.is_dictionary or idl_type.base_type == 'Dictio nary',
238 'is_explicit_nullable': idl_type.is_explicit_nullable,
234 'is_nullable': idl_type.is_nullable, 239 'is_nullable': idl_type.is_nullable,
235 'is_optional': argument.is_optional, 240 'is_optional': argument.is_optional,
236 'is_variadic': argument.is_variadic, 241 'is_variadic': argument.is_variadic,
237 'is_variadic_wrapper_type': is_variadic_wrapper_type, 242 'is_variadic_wrapper_type': is_variadic_wrapper_type,
238 'is_wrapper_type': idl_type.is_wrapper_type, 243 'is_wrapper_type': idl_type.is_wrapper_type,
239 'name': argument.name, 244 'name': argument.name,
240 'private_script_cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( 245 'private_script_cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value(
241 argument.name, isolate='scriptState->isolate()', 246 argument.name, isolate='scriptState->isolate()',
242 creation_context='scriptState->context()->Global()'), 247 creation_context='scriptState->context()->Global()'),
243 'use_permissive_dictionary_conversion': 'PermissiveDictionaryConversion' in extended_attributes, 248 'use_permissive_dictionary_conversion': 'PermissiveDictionaryConversion' in extended_attributes,
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 451
447 IdlOperation.returns_promise = property(method_returns_promise) 452 IdlOperation.returns_promise = property(method_returns_promise)
448 453
449 454
450 def argument_conversion_needs_exception_state(method, argument): 455 def argument_conversion_needs_exception_state(method, argument):
451 idl_type = argument.idl_type 456 idl_type = argument.idl_type
452 return (idl_type.v8_conversion_needs_exception_state or 457 return (idl_type.v8_conversion_needs_exception_state or
453 argument.is_variadic or 458 argument.is_variadic or
454 (method.returns_promise and (idl_type.is_string_type or 459 (method.returns_promise and (idl_type.is_string_type or
455 idl_type.is_enum))) 460 idl_type.is_enum)))
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/scripts/v8_types.py » ('j') | Source/bindings/templates/methods.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698