| 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 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 | 921 |
| 922 ################################################################################ | 922 ################################################################################ |
| 923 # Utility properties for nullable types | 923 # Utility properties for nullable types |
| 924 ################################################################################ | 924 ################################################################################ |
| 925 | 925 |
| 926 | 926 |
| 927 def cpp_type_has_null_value(idl_type): | 927 def cpp_type_has_null_value(idl_type): |
| 928 # - String types (String/AtomicString) represent null as a null string, | 928 # - String types (String/AtomicString) represent null as a null string, |
| 929 # i.e. one for which String::isNull() returns true. | 929 # i.e. one for which String::isNull() returns true. |
| 930 # - Enum types, as they are implemented as Strings. | 930 # - Enum types, as they are implemented as Strings. |
| 931 # - Wrapper types (raw pointer or RefPtr/PassRefPtr) represent null as | 931 # - Interface types (raw pointer or RefPtr/PassRefPtr) represent null as |
| 932 # a null pointer. | 932 # a null pointer. |
| 933 # - Union types, as thier container classes can represent null value. | 933 # - Union types, as thier container classes can represent null value. |
| 934 # - 'Object' type. We use ScriptValue for object type. | 934 # - 'Object' type. We use ScriptValue for object type. |
| 935 return (idl_type.is_string_type or idl_type.is_wrapper_type or | 935 return (idl_type.is_string_type or idl_type.is_interface_type or |
| 936 idl_type.is_enum or idl_type.is_union_type | 936 idl_type.is_enum or idl_type.is_union_type |
| 937 or idl_type.base_type == 'object') | 937 or idl_type.base_type == 'object') |
| 938 | 938 |
| 939 IdlTypeBase.cpp_type_has_null_value = property(cpp_type_has_null_value) | 939 IdlTypeBase.cpp_type_has_null_value = property(cpp_type_has_null_value) |
| 940 | 940 |
| 941 | 941 |
| 942 def is_implicit_nullable(idl_type): | 942 def is_implicit_nullable(idl_type): |
| 943 # Nullable type where the corresponding C++ type supports a null value. | 943 # Nullable type where the corresponding C++ type supports a null value. |
| 944 return idl_type.is_nullable and idl_type.cpp_type_has_null_value | 944 return idl_type.is_nullable and idl_type.cpp_type_has_null_value |
| 945 | 945 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 969 number_of_nullable_member_types_union) | 969 number_of_nullable_member_types_union) |
| 970 | 970 |
| 971 | 971 |
| 972 def includes_nullable_type_union(idl_type): | 972 def includes_nullable_type_union(idl_type): |
| 973 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type | 973 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type |
| 974 return idl_type.number_of_nullable_member_types == 1 | 974 return idl_type.number_of_nullable_member_types == 1 |
| 975 | 975 |
| 976 IdlTypeBase.includes_nullable_type = False | 976 IdlTypeBase.includes_nullable_type = False |
| 977 IdlNullableType.includes_nullable_type = True | 977 IdlNullableType.includes_nullable_type = True |
| 978 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) | 978 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) |
| OLD | NEW |