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

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

Issue 384773004: IDL clean-up: Rename is_nullable_simple => is_implicit_nullable (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@idl-nullable-method-return-type
Patch Set: order, order Created 6 years, 5 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 | « Source/bindings/scripts/v8_methods.py ('k') | Source/bindings/templates/attributes.cpp » ('j') | 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 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 """Converts an expression that is a valid C++ literal for this type.""" 716 """Converts an expression that is a valid C++ literal for this type."""
717 # FIXME: add validation that idl_type and idl_literal are compatible 717 # FIXME: add validation that idl_type and idl_literal are compatible
718 literal_value = str(idl_literal) 718 literal_value = str(idl_literal)
719 if idl_type.base_type in CPP_UNSIGNED_TYPES: 719 if idl_type.base_type in CPP_UNSIGNED_TYPES:
720 return literal_value + 'u' 720 return literal_value + 'u'
721 return literal_value 721 return literal_value
722 722
723 IdlType.literal_cpp_value = literal_cpp_value 723 IdlType.literal_cpp_value = literal_cpp_value
724 724
725 725
726 def is_nullable_simple(idl_type): 726 ################################################################################
727 # Utility properties for nullable types
728 ################################################################################
729
730
731 def is_implicit_nullable(idl_type):
727 # Nullable type where the corresponding C++ type supports a null value. 732 # Nullable type where the corresponding C++ type supports a null value.
728 # - String types (String/AtomicString) represent null as a null string, 733 # - String types (String/AtomicString) represent null as a null string,
729 # i.e. one for which String::isNull() returns true. 734 # i.e. one for which String::isNull() returns true.
730 # - Wrapper types (raw pointer or RefPtr/PassRefPtr) represent null as 735 # - Wrapper types (raw pointer or RefPtr/PassRefPtr) represent null as
731 # a null pointer. 736 # a null pointer.
732 return idl_type.is_nullable and ( 737 return idl_type.is_nullable and (
733 (idl_type.is_string_type or idl_type.is_wrapper_type) and 738 (idl_type.is_string_type or idl_type.is_wrapper_type) and
734 not idl_type.native_array_element_type) 739 not idl_type.native_array_element_type)
735 740
736 IdlType.is_nullable_simple = property(is_nullable_simple) 741
737 IdlUnionType.is_nullable_simple = False 742 def is_explicit_nullable(idl_type):
743 # Nullable type that isn't implicit nullable (see above.) For such types,
744 # we use Nullable<T> or similar explicit ways to represent a null value.
745 return idl_type.is_nullable and not idl_type.is_implicit_nullable
746
747 IdlType.is_implicit_nullable = property(is_implicit_nullable)
748 IdlType.is_explicit_nullable = property(is_explicit_nullable)
749 IdlUnionType.is_implicit_nullable = False
750 IdlUnionType.is_explicit_nullable = property(is_explicit_nullable)
OLDNEW
« no previous file with comments | « Source/bindings/scripts/v8_methods.py ('k') | Source/bindings/templates/attributes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698