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

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

Issue 466323002: IDL: Use Nullable for union type return value (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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
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 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 return statement 712 return statement
713 713
714 714
715 def v8_set_return_value_union(idl_type, cpp_value, extended_attributes=None, scr ipt_wrappable='', release=False, for_main_world=False): 715 def v8_set_return_value_union(idl_type, cpp_value, extended_attributes=None, scr ipt_wrappable='', release=False, for_main_world=False):
716 """ 716 """
717 release: can be either False (False for all member types) or 717 release: can be either False (False for all member types) or
718 a sequence (list or tuple) of booleans (if specified individually). 718 a sequence (list or tuple) of booleans (if specified individually).
719 """ 719 """
720 720
721 return [ 721 return [
722 member_type.v8_set_return_value(cpp_value + str(i), 722 member_type.v8_set_return_value(cpp_value.format(index=i),
723 extended_attributes, 723 extended_attributes,
724 script_wrappable, 724 script_wrappable,
725 release and release[i], 725 release and release[i],
726 for_main_world) 726 for_main_world)
727 for i, member_type in 727 for i, member_type in
728 enumerate(idl_type.member_types)] 728 enumerate(idl_type.member_types)]
729 729
730 IdlType.v8_set_return_value = v8_set_return_value 730 IdlType.v8_set_return_value = v8_set_return_value
731 IdlUnionType.v8_set_return_value = v8_set_return_value_union 731 IdlUnionType.v8_set_return_value = v8_set_return_value_union
732 732
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 804
805 def is_explicit_nullable(idl_type): 805 def is_explicit_nullable(idl_type):
806 # Nullable type that isn't implicit nullable (see above.) For such types, 806 # Nullable type that isn't implicit nullable (see above.) For such types,
807 # we use Nullable<T> or similar explicit ways to represent a null value. 807 # we use Nullable<T> or similar explicit ways to represent a null value.
808 return idl_type.is_nullable and not idl_type.is_implicit_nullable 808 return idl_type.is_nullable and not idl_type.is_implicit_nullable
809 809
810 IdlType.is_implicit_nullable = property(is_implicit_nullable) 810 IdlType.is_implicit_nullable = property(is_implicit_nullable)
811 IdlType.is_explicit_nullable = property(is_explicit_nullable) 811 IdlType.is_explicit_nullable = property(is_explicit_nullable)
812 IdlUnionType.is_implicit_nullable = False 812 IdlUnionType.is_implicit_nullable = False
813 IdlUnionType.is_explicit_nullable = property(is_explicit_nullable) 813 IdlUnionType.is_explicit_nullable = property(is_explicit_nullable)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698