Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: Source/bindings/scripts/v8_types.py

Issue 964163004: IDL: All interface types are implicitly nullable (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698