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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 if 'EnforceRange' in extended_attributes: | 544 if 'EnforceRange' in extended_attributes: |
545 arguments = ', '.join([v8_value, 'EnforceRange', 'exceptionState']) | 545 arguments = ', '.join([v8_value, 'EnforceRange', 'exceptionState']) |
546 elif 'Clamp' in extended_attributes: | 546 elif 'Clamp' in extended_attributes: |
547 arguments = ', '.join([v8_value, 'Clamp', 'exceptionState']) | 547 arguments = ', '.join([v8_value, 'Clamp', 'exceptionState']) |
548 elif idl_type.v8_conversion_needs_exception_state: | 548 elif idl_type.v8_conversion_needs_exception_state: |
549 arguments = ', '.join([v8_value, 'exceptionState']) | 549 arguments = ', '.join([v8_value, 'exceptionState']) |
550 else: | 550 else: |
551 arguments = v8_value | 551 arguments = v8_value |
552 | 552 |
553 if base_idl_type in V8_VALUE_TO_CPP_VALUE: | 553 if base_idl_type in V8_VALUE_TO_CPP_VALUE: |
554 # FIXME: Once float/double are implemented per-specification (without | |
555 # [TypeChecking=Unrestricted]) this special handling can be dropped. | |
556 # http://crbug.com/354298 | |
557 if base_idl_type in ('float', 'double') and not restricted_float: | |
558 base_idl_type = 'unrestricted ' + base_idl_type | |
559 cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type] | 554 cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type] |
560 elif idl_type.is_array_buffer_or_view: | 555 elif idl_type.is_array_buffer_or_view: |
561 cpp_expression_format = ( | 556 cpp_expression_format = ( |
562 '{v8_value}->Is{idl_type}() ? ' | 557 '{v8_value}->Is{idl_type}() ? ' |
563 'V8{idl_type}::toImpl(v8::Local<v8::{idl_type}>::Cast({v8_value})) :
0') | 558 'V8{idl_type}::toImpl(v8::Local<v8::{idl_type}>::Cast({v8_value})) :
0') |
564 elif idl_type.use_output_parameter_for_result: | 559 elif idl_type.use_output_parameter_for_result: |
565 if idl_type.includes_nullable_type: | 560 if idl_type.includes_nullable_type: |
566 base_idl_type = idl_type.cpp_type + 'OrNull' | 561 base_idl_type = idl_type.cpp_type + 'OrNull' |
567 cpp_expression_format = 'V8{idl_type}::toImpl({isolate}, {v8_value}, {va
riable_name}, exceptionState)' | 562 cpp_expression_format = 'V8{idl_type}::toImpl({isolate}, {v8_value}, {va
riable_name}, exceptionState)' |
568 else: | 563 else: |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 number_of_nullable_member_types_union) | 964 number_of_nullable_member_types_union) |
970 | 965 |
971 | 966 |
972 def includes_nullable_type_union(idl_type): | 967 def includes_nullable_type_union(idl_type): |
973 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type | 968 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type |
974 return idl_type.number_of_nullable_member_types == 1 | 969 return idl_type.number_of_nullable_member_types == 1 |
975 | 970 |
976 IdlTypeBase.includes_nullable_type = False | 971 IdlTypeBase.includes_nullable_type = False |
977 IdlNullableType.includes_nullable_type = True | 972 IdlNullableType.includes_nullable_type = True |
978 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) | 973 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) |
OLD | NEW |