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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 elif definitions.dictionaries: | 190 elif definitions.dictionaries: |
191 definition = next(definitions.dictionaries.itervalues()) | 191 definition = next(definitions.dictionaries.itervalues()) |
192 interface_info = { | 192 interface_info = { |
193 'is_callback_interface': False, | 193 'is_callback_interface': False, |
194 'is_dictionary': True, | 194 'is_dictionary': True, |
195 'referenced_interfaces': None, | 195 'referenced_interfaces': None, |
196 } | 196 } |
197 else: | 197 else: |
198 raise Exception('IDL file must contain one interface or dictionary') | 198 raise Exception('IDL file must contain one interface or dictionary') |
199 | 199 |
200 self.union_types.update( | 200 this_union_types = collect_union_types_from_definitions(definitions) |
201 collect_union_types_from_definitions(definitions)) | 201 self.union_types.update(this_union_types) |
202 | 202 |
203 extended_attributes = definition.extended_attributes | 203 extended_attributes = definition.extended_attributes |
204 implemented_as = extended_attributes.get('ImplementedAs') | 204 implemented_as = extended_attributes.get('ImplementedAs') |
205 full_path = os.path.realpath(idl_filename) | 205 full_path = os.path.realpath(idl_filename) |
206 this_include_path = None if 'NoImplHeader' in extended_attributes else i nclude_path(idl_filename, implemented_as) | 206 this_include_path = None if 'NoImplHeader' in extended_attributes else i nclude_path(idl_filename, implemented_as) |
207 if definition.is_partial: | 207 if definition.is_partial: |
208 # We don't create interface_info for partial interfaces, but | 208 # We don't create interface_info for partial interfaces, but |
209 # adds paths to another dict. | 209 # adds paths to another dict. |
210 self.add_paths_to_partials_dict(definition.name, full_path, this_inc lude_path) | 210 self.add_paths_to_partials_dict(definition.name, full_path, this_inc lude_path) |
211 return | 211 return |
212 | 212 |
213 # 'implements' statements can be included in either the file for the | 213 # 'implements' statements can be included in either the file for the |
214 # implement*ing* interface (lhs of 'implements') or implement*ed* interf ace | 214 # implement*ing* interface (lhs of 'implements') or implement*ed* interf ace |
215 # (rhs of 'implements'). Store both for now, then merge to implement*ing * | 215 # (rhs of 'implements'). Store both for now, then merge to implement*ing * |
216 # interface later. | 216 # interface later. |
217 left_interfaces, right_interfaces = get_implements_from_definitions( | 217 left_interfaces, right_interfaces = get_implements_from_definitions( |
218 definitions, definition.name) | 218 definitions, definition.name) |
219 | 219 |
220 interface_info.update({ | 220 interface_info.update({ |
221 'extended_attributes': extended_attributes, | 221 'extended_attributes': extended_attributes, |
222 'full_path': full_path, | 222 'full_path': full_path, |
223 'has_union_types': len(this_union_types) > 0, # explicit len(...) > 0 to convert boolean | |
Jens Widell
2014/10/28 11:31:37
Another way of explicitly converting to bool would
bashi
2014/10/29 01:34:32
Definitely better way:) Done.
| |
223 'implemented_as': implemented_as, | 224 'implemented_as': implemented_as, |
224 'implemented_by_interfaces': left_interfaces, | 225 'implemented_by_interfaces': left_interfaces, |
225 'implements_interfaces': right_interfaces, | 226 'implements_interfaces': right_interfaces, |
226 'include_path': this_include_path, | 227 'include_path': this_include_path, |
227 # FIXME: temporary private field, while removing old treatement of | 228 # FIXME: temporary private field, while removing old treatement of |
228 # 'implements': http://crbug.com/360435 | 229 # 'implements': http://crbug.com/360435 |
229 'is_legacy_treat_as_partial_interface': 'LegacyTreatAsPartialInterfa ce' in extended_attributes, | 230 'is_legacy_treat_as_partial_interface': 'LegacyTreatAsPartialInterfa ce' in extended_attributes, |
230 'parent': definition.parent, | 231 'parent': definition.parent, |
231 'relative_dir': relative_dir_posix(idl_filename), | 232 'relative_dir': relative_dir_posix(idl_filename), |
232 }) | 233 }) |
(...skipping 29 matching lines...) Expand all Loading... | |
262 for idl_filename in idl_files: | 263 for idl_filename in idl_files: |
263 info_collector.collect_info(idl_filename) | 264 info_collector.collect_info(idl_filename) |
264 | 265 |
265 write_pickle_file(options.interfaces_info_file, | 266 write_pickle_file(options.interfaces_info_file, |
266 info_collector.get_info_as_dict(), | 267 info_collector.get_info_as_dict(), |
267 options.write_file_only_if_changed) | 268 options.write_file_only_if_changed) |
268 | 269 |
269 | 270 |
270 if __name__ == '__main__': | 271 if __name__ == '__main__': |
271 sys.exit(main()) | 272 sys.exit(main()) |
OLD | NEW |