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 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 ################################################################################ | 931 ################################################################################ |
932 | 932 |
933 | 933 |
934 def cpp_type_has_null_value(idl_type): | 934 def cpp_type_has_null_value(idl_type): |
935 # - String types (String/AtomicString) represent null as a null string, | 935 # - String types (String/AtomicString) represent null as a null string, |
936 # i.e. one for which String::isNull() returns true. | 936 # i.e. one for which String::isNull() returns true. |
937 # - Enum types, as they are implemented as Strings. | 937 # - Enum types, as they are implemented as Strings. |
938 # - Interface types (raw pointer or RefPtr/PassRefPtr) represent null as | 938 # - Interface types (raw pointer or RefPtr/PassRefPtr) represent null as |
939 # a null pointer. | 939 # a null pointer. |
940 # - Union types, as thier container classes can represent null value. | 940 # - Union types, as thier container classes can represent null value. |
941 # - 'Object' type. We use ScriptValue for object type. | 941 # - 'Object' and 'any' type. We use ScriptValue for object type. |
942 return (idl_type.is_string_type or idl_type.is_interface_type or | 942 return (idl_type.is_string_type or idl_type.is_interface_type or |
943 idl_type.is_enum or idl_type.is_union_type | 943 idl_type.is_enum or idl_type.is_union_type |
944 or idl_type.base_type == 'object' | 944 or idl_type.base_type == 'object' or idl_type.base_type == 'any' |
945 or idl_type.is_callback_function or idl_type.is_callback_interface) | 945 or idl_type.is_callback_function or idl_type.is_callback_interface) |
946 | 946 |
947 IdlTypeBase.cpp_type_has_null_value = property(cpp_type_has_null_value) | 947 IdlTypeBase.cpp_type_has_null_value = property(cpp_type_has_null_value) |
948 | 948 |
949 | 949 |
950 def is_implicit_nullable(idl_type): | 950 def is_implicit_nullable(idl_type): |
951 # Nullable type where the corresponding C++ type supports a null value. | 951 # Nullable type where the corresponding C++ type supports a null value. |
952 return idl_type.is_nullable and idl_type.cpp_type_has_null_value | 952 return idl_type.is_nullable and idl_type.cpp_type_has_null_value |
953 | 953 |
954 | 954 |
(...skipping 22 matching lines...) Expand all Loading... |
977 number_of_nullable_member_types_union) | 977 number_of_nullable_member_types_union) |
978 | 978 |
979 | 979 |
980 def includes_nullable_type_union(idl_type): | 980 def includes_nullable_type_union(idl_type): |
981 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type | 981 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type |
982 return idl_type.number_of_nullable_member_types == 1 | 982 return idl_type.number_of_nullable_member_types == 1 |
983 | 983 |
984 IdlTypeBase.includes_nullable_type = False | 984 IdlTypeBase.includes_nullable_type = False |
985 IdlNullableType.includes_nullable_type = True | 985 IdlNullableType.includes_nullable_type = True |
986 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) | 986 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) |
OLD | NEW |