OLD | NEW |
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 Loading... |
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 Loading... |
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()) |
OLD | NEW |