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

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

Issue 385603002: IDL: Support using nullable on any method return type (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use_result_local => use_local_result 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/methods.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 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 714
715 def literal_cpp_value(idl_type, idl_literal): 715 def literal_cpp_value(idl_type, idl_literal):
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
725
726 def is_nullable_simple(idl_type):
727 # Nullable type where the corresponding C++ type supports a null value.
728 # - String types (String/AtomicString) represent null as a null string,
729 # i.e. one for which String::isNull() returns true.
730 # - Wrapper types (raw pointer or RefPtr/PassRefPtr) represent null as
731 # a null pointer.
732 return idl_type.is_nullable and (
733 (idl_type.is_string_type or idl_type.is_wrapper_type) and
734 not idl_type.native_array_element_type)
735
736 IdlType.is_nullable_simple = property(is_nullable_simple)
737 IdlUnionType.is_nullable_simple = False
OLDNEW
« no previous file with comments | « Source/bindings/scripts/v8_methods.py ('k') | Source/bindings/templates/methods.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698