| 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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 set_expression = None | 619 set_expression = None |
| 620 # Optional expression that returns true if the conversion fails. | 620 # Optional expression that returns true if the conversion fails. |
| 621 check_expression = None | 621 check_expression = None |
| 622 # Optional expression used as the return value when returning. Only | 622 # Optional expression used as the return value when returning. Only |
| 623 # meaningful if 'check_expression' is not None. | 623 # meaningful if 'check_expression' is not None. |
| 624 return_expression = bailout_return_value | 624 return_expression = bailout_return_value |
| 625 | 625 |
| 626 if idl_type.is_string_type or idl_type.v8_conversion_needs_exception_state: | 626 if idl_type.is_string_type or idl_type.v8_conversion_needs_exception_state: |
| 627 # Types for which conversion can fail and that need error handling. | 627 # Types for which conversion can fail and that need error handling. |
| 628 | 628 |
| 629 if use_exception_state: | 629 check_expression = 'exceptionState.hadException()' |
| 630 check_expression = 'exceptionState.hadException()' | |
| 631 else: | |
| 632 check_expression = 'exceptionState.throwIfNeeded()' | |
| 633 | 630 |
| 634 if idl_type.is_dictionary or idl_type.is_union_type: | 631 if idl_type.is_dictionary or idl_type.is_union_type: |
| 635 set_expression = cpp_value | 632 set_expression = cpp_value |
| 636 else: | 633 else: |
| 637 assign_expression = cpp_value | 634 assign_expression = cpp_value |
| 638 # Note: 'not idl_type.v8_conversion_needs_exception_state' implies | 635 # Note: 'not idl_type.v8_conversion_needs_exception_state' implies |
| 639 # 'idl_type.is_string_type', but there are types for which both are | 636 # 'idl_type.is_string_type', but there are types for which both are |
| 640 # true (ByteString and USVString), so using idl_type.is_string_type | 637 # true (ByteString and USVString), so using idl_type.is_string_type |
| 641 # as the condition here would be wrong. | 638 # as the condition here would be wrong. |
| 642 if not idl_type.v8_conversion_needs_exception_state: | 639 if not idl_type.v8_conversion_needs_exception_state: |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 number_of_nullable_member_types_union) | 988 number_of_nullable_member_types_union) |
| 992 | 989 |
| 993 | 990 |
| 994 def includes_nullable_type_union(idl_type): | 991 def includes_nullable_type_union(idl_type): |
| 995 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type | 992 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type |
| 996 return idl_type.number_of_nullable_member_types == 1 | 993 return idl_type.number_of_nullable_member_types == 1 |
| 997 | 994 |
| 998 IdlTypeBase.includes_nullable_type = False | 995 IdlTypeBase.includes_nullable_type = False |
| 999 IdlNullableType.includes_nullable_type = True | 996 IdlNullableType.includes_nullable_type = True |
| 1000 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) | 997 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) |
| OLD | NEW |