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 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 # - Interface 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_interface_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 or idl_type.is_callback_function or idl_type.is_callback_interface) |
938 | 939 |
939 IdlTypeBase.cpp_type_has_null_value = property(cpp_type_has_null_value) | 940 IdlTypeBase.cpp_type_has_null_value = property(cpp_type_has_null_value) |
940 | 941 |
941 | 942 |
942 def is_implicit_nullable(idl_type): | 943 def is_implicit_nullable(idl_type): |
943 # Nullable type where the corresponding C++ type supports a null value. | 944 # 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 | 945 return idl_type.is_nullable and idl_type.cpp_type_has_null_value |
945 | 946 |
946 | 947 |
947 def is_explicit_nullable(idl_type): | 948 def is_explicit_nullable(idl_type): |
(...skipping 21 matching lines...) Expand all Loading... |
969 number_of_nullable_member_types_union) | 970 number_of_nullable_member_types_union) |
970 | 971 |
971 | 972 |
972 def includes_nullable_type_union(idl_type): | 973 def includes_nullable_type_union(idl_type): |
973 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type | 974 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type |
974 return idl_type.number_of_nullable_member_types == 1 | 975 return idl_type.number_of_nullable_member_types == 1 |
975 | 976 |
976 IdlTypeBase.includes_nullable_type = False | 977 IdlTypeBase.includes_nullable_type = False |
977 IdlNullableType.includes_nullable_type = True | 978 IdlNullableType.includes_nullable_type = True |
978 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) | 979 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) |
OLD | NEW |