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

Side by Side Diff: Source/bindings/scripts/idl_definitions.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 | « no previous file | Source/bindings/scripts/v8_attributes.py » ('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 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 # interface type. We do not distinguish these, and just use the type name. 762 # interface type. We do not distinguish these, and just use the type name.
763 if node_class in ['PrimitiveType', 'Typeref']: 763 if node_class in ['PrimitiveType', 'Typeref']:
764 # unrestricted syntax: unrestricted double | unrestricted float 764 # unrestricted syntax: unrestricted double | unrestricted float
765 is_unrestricted = node.GetProperty('UNRESTRICTED') or False 765 is_unrestricted = node.GetProperty('UNRESTRICTED') or False
766 return IdlType(node.GetName(), is_array=is_array, is_nullable=is_nullabl e, is_unrestricted=is_unrestricted) 766 return IdlType(node.GetName(), is_array=is_array, is_nullable=is_nullabl e, is_unrestricted=is_unrestricted)
767 elif node_class == 'Any': 767 elif node_class == 'Any':
768 return IdlType('any', is_array=is_array, is_nullable=is_nullable) 768 return IdlType('any', is_array=is_array, is_nullable=is_nullable)
769 elif node_class == 'Sequence': 769 elif node_class == 'Sequence':
770 if is_array: 770 if is_array:
771 raise ValueError('Arrays of sequences are not supported') 771 raise ValueError('Arrays of sequences are not supported')
772 return sequence_node_to_type(node, is_nullable=is_nullable) 772 sequence_is_nullable = node.GetProperty('NULLABLE') or False
773 return sequence_node_to_type(node, is_nullable=sequence_is_nullable)
773 elif node_class == 'UnionType': 774 elif node_class == 'UnionType':
774 if is_array: 775 if is_array:
775 raise ValueError('Arrays of unions are not supported') 776 raise ValueError('Arrays of unions are not supported')
776 return union_type_node_to_idl_union_type(node, is_nullable=is_nullable) 777 return union_type_node_to_idl_union_type(node, is_nullable=is_nullable)
777 raise ValueError('Unrecognized node class: %s' % node_class) 778 raise ValueError('Unrecognized node class: %s' % node_class)
778 779
779 780
780 def sequence_node_to_type(node, is_nullable=False): 781 def sequence_node_to_type(node, is_nullable=False):
781 children = node.GetChildren() 782 children = node.GetChildren()
782 if len(children) != 1: 783 if len(children) != 1:
(...skipping 14 matching lines...) Expand all
797 child_class = child.GetClass() 798 child_class = child.GetClass()
798 if child_class != 'Type': 799 if child_class != 'Type':
799 raise ValueError('Unrecognized node class: %s' % child_class) 800 raise ValueError('Unrecognized node class: %s' % child_class)
800 return type_node_to_type(child) 801 return type_node_to_type(child)
801 802
802 803
803 def union_type_node_to_idl_union_type(node, is_nullable=False): 804 def union_type_node_to_idl_union_type(node, is_nullable=False):
804 member_types = [type_node_to_type(member_type_node) 805 member_types = [type_node_to_type(member_type_node)
805 for member_type_node in node.GetChildren()] 806 for member_type_node in node.GetChildren()]
806 return IdlUnionType(member_types, is_nullable=is_nullable) 807 return IdlUnionType(member_types, is_nullable=is_nullable)
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/scripts/v8_attributes.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698