| 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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 | 470 |
| 471 | 471 |
| 472 def v8_conversion_needs_exception_state(idl_type): | 472 def v8_conversion_needs_exception_state(idl_type): |
| 473 return (idl_type.is_numeric_type or | 473 return (idl_type.is_numeric_type or |
| 474 idl_type.is_dictionary or | 474 idl_type.is_dictionary or |
| 475 idl_type.name in ('ByteString', 'ScalarValueString')) | 475 idl_type.name in ('ByteString', 'ScalarValueString')) |
| 476 | 476 |
| 477 IdlType.v8_conversion_needs_exception_state = property(v8_conversion_needs_excep
tion_state) | 477 IdlType.v8_conversion_needs_exception_state = property(v8_conversion_needs_excep
tion_state) |
| 478 | 478 |
| 479 | 479 |
| 480 TRIVIAL_CONVERSIONS = frozenset([ |
| 481 'any', |
| 482 'boolean', |
| 483 'Dictionary', |
| 484 'NodeFilter', |
| 485 'XPathNSResolver' |
| 486 ]) |
| 487 |
| 488 |
| 480 def v8_conversion_is_trivial(idl_type): | 489 def v8_conversion_is_trivial(idl_type): |
| 481 # The conversion is a simple expression that returns the converted value and | 490 # The conversion is a simple expression that returns the converted value and |
| 482 # cannot raise an exception. | 491 # cannot raise an exception. |
| 483 return (idl_type.base_type == 'boolean' or | 492 return (idl_type.base_type in TRIVIAL_CONVERSIONS or |
| 484 idl_type.base_type == 'Dictionary' or | |
| 485 idl_type.is_wrapper_type) | 493 idl_type.is_wrapper_type) |
| 486 | 494 |
| 487 IdlType.v8_conversion_is_trivial = property(v8_conversion_is_trivial) | 495 IdlType.v8_conversion_is_trivial = property(v8_conversion_is_trivial) |
| 488 | 496 |
| 489 | 497 |
| 490 def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index, isolat
e): | 498 def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index, isolat
e): |
| 491 if idl_type.name == 'void': | 499 if idl_type.name == 'void': |
| 492 return '' | 500 return '' |
| 493 | 501 |
| 494 # Array or sequence types | 502 # Array or sequence types |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 | 842 |
| 835 | 843 |
| 836 def is_explicit_nullable(idl_type): | 844 def is_explicit_nullable(idl_type): |
| 837 # Nullable type that isn't implicit nullable (see above.) For such types, | 845 # Nullable type that isn't implicit nullable (see above.) For such types, |
| 838 # we use Nullable<T> or similar explicit ways to represent a null value. | 846 # we use Nullable<T> or similar explicit ways to represent a null value. |
| 839 return idl_type.is_nullable and not idl_type.is_implicit_nullable | 847 return idl_type.is_nullable and not idl_type.is_implicit_nullable |
| 840 | 848 |
| 841 IdlTypeBase.is_implicit_nullable = property(is_implicit_nullable) | 849 IdlTypeBase.is_implicit_nullable = property(is_implicit_nullable) |
| 842 IdlUnionType.is_implicit_nullable = False | 850 IdlUnionType.is_implicit_nullable = False |
| 843 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable) | 851 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable) |
| OLD | NEW |