| 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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 # Array or sequence types | 534 # Array or sequence types |
| 535 native_array_element_type = idl_type.native_array_element_type | 535 native_array_element_type = idl_type.native_array_element_type |
| 536 if native_array_element_type: | 536 if native_array_element_type: |
| 537 return v8_value_to_cpp_value_array_or_sequence(native_array_element_type
, v8_value, index, isolate) | 537 return v8_value_to_cpp_value_array_or_sequence(native_array_element_type
, v8_value, index, isolate) |
| 538 | 538 |
| 539 # Simple types | 539 # Simple types |
| 540 idl_type = idl_type.preprocessed_type | 540 idl_type = idl_type.preprocessed_type |
| 541 add_includes_for_type(idl_type) | 541 add_includes_for_type(idl_type) |
| 542 base_idl_type = idl_type.as_union_type.name if idl_type.is_union_type else i
dl_type.base_type | 542 base_idl_type = idl_type.as_union_type.name if idl_type.is_union_type else i
dl_type.base_type |
| 543 | 543 |
| 544 if 'EnforceRange' in extended_attributes: | 544 if idl_type.is_integer_type: |
| 545 arguments = ', '.join([v8_value, 'EnforceRange', 'exceptionState']) | 545 configuration = 'NormalConversion' |
| 546 elif 'Clamp' in extended_attributes: | 546 if 'EnforceRange' in extended_attributes: |
| 547 arguments = ', '.join([v8_value, 'Clamp', 'exceptionState']) | 547 configuration = 'EnforceRange' |
| 548 elif 'Clamp' in extended_attributes: |
| 549 configuration = 'Clamp' |
| 550 arguments = ', '.join([v8_value, configuration, 'exceptionState']) |
| 548 elif idl_type.v8_conversion_needs_exception_state: | 551 elif idl_type.v8_conversion_needs_exception_state: |
| 549 arguments = ', '.join([v8_value, 'exceptionState']) | 552 arguments = ', '.join([v8_value, 'exceptionState']) |
| 550 else: | 553 else: |
| 551 arguments = v8_value | 554 arguments = v8_value |
| 552 if base_idl_type in V8_VALUE_TO_CPP_VALUE: | 555 if base_idl_type in V8_VALUE_TO_CPP_VALUE: |
| 553 cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type] | 556 cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type] |
| 554 elif idl_type.is_array_buffer_or_view: | 557 elif idl_type.is_array_buffer_or_view: |
| 555 cpp_expression_format = ( | 558 cpp_expression_format = ( |
| 556 '{v8_value}->Is{idl_type}() ? ' | 559 '{v8_value}->Is{idl_type}() ? ' |
| 557 'V8{idl_type}::toImpl(v8::Local<v8::{idl_type}>::Cast({v8_value})) :
0') | 560 'V8{idl_type}::toImpl(v8::Local<v8::{idl_type}>::Cast({v8_value})) :
0') |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 number_of_nullable_member_types_union) | 969 number_of_nullable_member_types_union) |
| 967 | 970 |
| 968 | 971 |
| 969 def includes_nullable_type_union(idl_type): | 972 def includes_nullable_type_union(idl_type): |
| 970 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type | 973 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type |
| 971 return idl_type.number_of_nullable_member_types == 1 | 974 return idl_type.number_of_nullable_member_types == 1 |
| 972 | 975 |
| 973 IdlTypeBase.includes_nullable_type = False | 976 IdlTypeBase.includes_nullable_type = False |
| 974 IdlNullableType.includes_nullable_type = True | 977 IdlNullableType.includes_nullable_type = True |
| 975 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) | 978 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) |
| OLD | NEW |