| OLD | NEW |
| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 not idl_type.is_wrapper_type and | 337 not idl_type.is_wrapper_type and |
| 338 not idl_type.is_basic_type): | 338 not idl_type.is_basic_type): |
| 339 raise Exception('Private scripts supports only primitive types and DOM w
rappers.') | 339 raise Exception('Private scripts supports only primitive types and DOM w
rappers.') |
| 340 | 340 |
| 341 release = False | 341 release = False |
| 342 # [CallWith=ScriptState], [RaisesException] | 342 # [CallWith=ScriptState], [RaisesException] |
| 343 if use_local_result(method): | 343 if use_local_result(method): |
| 344 if idl_type.is_explicit_nullable: | 344 if idl_type.is_explicit_nullable: |
| 345 # result is of type Nullable<T> | 345 # result is of type Nullable<T> |
| 346 cpp_value = 'result.get()' | 346 cpp_value = 'result.get()' |
| 347 elif idl_type.is_union_type: |
| 348 cpp_value = 'result{index}.get()' |
| 347 else: | 349 else: |
| 348 cpp_value = 'result' | 350 cpp_value = 'result' |
| 349 release = idl_type.release | 351 release = idl_type.release |
| 350 | 352 |
| 351 script_wrappable = 'impl' if inherits_interface(interface_name, 'Node') else
'' | 353 script_wrappable = 'impl' if inherits_interface(interface_name, 'Node') else
'' |
| 352 return idl_type.v8_set_return_value(cpp_value, extended_attributes, script_w
rappable=script_wrappable, release=release, for_main_world=for_main_world) | 354 return idl_type.v8_set_return_value(cpp_value, extended_attributes, script_w
rappable=script_wrappable, release=release, for_main_world=for_main_world) |
| 353 | 355 |
| 354 | 356 |
| 355 def v8_value_to_local_cpp_variadic_value(argument, index, return_promise): | 357 def v8_value_to_local_cpp_variadic_value(argument, index, return_promise): |
| 356 assert argument.is_variadic | 358 assert argument.is_variadic |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 if 'NotEnumerable' in extended_attributes: | 396 if 'NotEnumerable' in extended_attributes: |
| 395 property_attributes_list.append('v8::DontEnum') | 397 property_attributes_list.append('v8::DontEnum') |
| 396 if 'Unforgeable' in extended_attributes: | 398 if 'Unforgeable' in extended_attributes: |
| 397 property_attributes_list.append('v8::ReadOnly') | 399 property_attributes_list.append('v8::ReadOnly') |
| 398 if property_attributes_list: | 400 if property_attributes_list: |
| 399 property_attributes_list.insert(0, 'v8::DontDelete') | 401 property_attributes_list.insert(0, 'v8::DontDelete') |
| 400 return property_attributes_list | 402 return property_attributes_list |
| 401 | 403 |
| 402 | 404 |
| 403 def union_arguments(idl_type): | 405 def union_arguments(idl_type): |
| 404 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u
nion types, for use in setting return value""" | 406 """Return list of ['result0', 'result1', ...] for union types, for use in se
tting return value""" |
| 405 return [arg | 407 return ['result%d' % i |
| 406 for i in range(len(idl_type.member_types)) | 408 for i in range(len(idl_type.member_types))] |
| 407 for arg in ['result%sEnabled' % i, 'result%s' % i]] | |
| 408 | 409 |
| 409 | 410 |
| 410 def argument_default_cpp_value(argument): | 411 def argument_default_cpp_value(argument): |
| 411 if not argument.default_value: | 412 if not argument.default_value: |
| 412 return None | 413 return None |
| 413 return argument.idl_type.literal_cpp_value(argument.default_value) | 414 return argument.idl_type.literal_cpp_value(argument.default_value) |
| 414 | 415 |
| 415 IdlType.union_arguments = property(lambda self: None) | 416 IdlType.union_arguments = property(lambda self: None) |
| 416 IdlUnionType.union_arguments = property(union_arguments) | 417 IdlUnionType.union_arguments = property(union_arguments) |
| 417 IdlArgument.default_cpp_value = property(argument_default_cpp_value) | 418 IdlArgument.default_cpp_value = property(argument_default_cpp_value) |
| OLD | NEW |