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

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

Issue 700093002: IDL: Support nullable union types (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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/idl_types.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 #!/usr/bin/python 1 #!/usr/bin/python
2 # 2 #
3 # Copyright (C) 2013 Google Inc. All rights reserved. 3 # Copyright (C) 2013 Google Inc. All rights reserved.
4 # 4 #
5 # Redistribution and use in source and binary forms, with or without 5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are 6 # modification, are permitted provided that the following conditions are
7 # met: 7 # met:
8 # 8 #
9 # * Redistributions of source code must retain the above copyright 9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer. 10 # notice, this list of conditions and the following disclaimer.
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 def get_put_forward_interfaces_from_definition(definition): 126 def get_put_forward_interfaces_from_definition(definition):
127 return sorted(set(attribute.idl_type.base_type 127 return sorted(set(attribute.idl_type.base_type
128 for attribute in definition.attributes 128 for attribute in definition.attributes
129 if 'PutForwards' in attribute.extended_attributes)) 129 if 'PutForwards' in attribute.extended_attributes))
130 130
131 131
132 def collect_union_types_from_definitions(definitions): 132 def collect_union_types_from_definitions(definitions):
133 """Traverse definitions and collect all union types.""" 133 """Traverse definitions and collect all union types."""
134 134
135 def union_types_from(things): 135 def union_types_from(things):
136 return (thing.idl_type for thing in things 136 return (thing.idl_type.as_union_type for thing in things
137 if thing.idl_type.is_union_type) 137 if thing.idl_type.is_union_type)
138 138
139 this_union_types = set() 139 this_union_types = set()
140 for interface in definitions.interfaces.itervalues(): 140 for interface in definitions.interfaces.itervalues():
141 this_union_types.update(union_types_from(interface.attributes)) 141 this_union_types.update(union_types_from(interface.attributes))
142 for operation in interface.operations: 142 for operation in interface.operations:
143 this_union_types.update(union_types_from(operation.arguments)) 143 this_union_types.update(union_types_from(operation.arguments))
144 if operation.idl_type.is_union_type: 144 if operation.idl_type.is_union_type:
145 this_union_types.add(operation.idl_type) 145 this_union_types.add(operation.idl_type)
146 for constructor in interface.constructors: 146 for constructor in interface.constructors:
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 276
277 write_pickle_file(options.interfaces_info_file, 277 write_pickle_file(options.interfaces_info_file,
278 info_collector.get_info_as_dict(), 278 info_collector.get_info_as_dict(),
279 options.write_file_only_if_changed) 279 options.write_file_only_if_changed)
280 write_pickle_file(options.component_info_file, 280 write_pickle_file(options.component_info_file,
281 info_collector.get_component_info_as_dict(), 281 info_collector.get_component_info_as_dict(),
282 options.write_file_only_if_changed) 282 options.write_file_only_if_changed)
283 283
284 if __name__ == '__main__': 284 if __name__ == '__main__':
285 sys.exit(main()) 285 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/scripts/idl_types.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698