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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 '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 if idl_type.is_integer_type: |
Jens Widell
2015/03/17 11:28:22
The preceding two cases, EnforceRange and Clamp, a
| |
550 arguments = ', '.join([v8_value, 'NormalConversion', 'exceptionState ']) | |
551 else: | |
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') |
558 elif idl_type.use_output_parameter_for_result: | 561 elif idl_type.use_output_parameter_for_result: |
559 if idl_type.includes_nullable_type: | 562 if idl_type.includes_nullable_type: |
(...skipping 406 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 |