| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Usage: collect_idls_into_json.py path_file.txt json_file.json | 6 """Usage: collect_idls_into_json.py path_file.txt json_file.json |
| 7 This script collects and organizes interface information and that information du
mps into json file. | 7 This script collects and organizes interface information and that information du
mps into json file. |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 import json | 10 import json |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 | 294 |
| 295 def operation_node_to_dict(operation_node): | 295 def operation_node_to_dict(operation_node): |
| 296 """Returns dictionary of operation's information. | 296 """Returns dictionary of operation's information. |
| 297 Args: | 297 Args: |
| 298 operation_node: operation node | 298 operation_node: operation node |
| 299 Returns: | 299 Returns: |
| 300 dictionary of operation's informantion | 300 dictionary of operation's informantion |
| 301 """ | 301 """ |
| 302 return { | 302 return { |
| 303 _NAME: get_operation_name(operation_node), | 303 _NAME: get_operation_name(operation_node), |
| 304 _ARGUMENTS: [argument_node_to_dict(argument) for argument in get_argumen
t_node_list(operation_node) if argument_node_to_dict(argument)], | 304 _ARGUMENTS: [argument_node_to_dict(argument) for argument in get_argumen
t_node_list(operation_node) |
| 305 if argument_node_to_dict(argument)], |
| 305 _TYPE: get_operation_type(operation_node), | 306 _TYPE: get_operation_type(operation_node), |
| 306 _EXTATTRIBUTES: [extattr_node_to_dict(extattr) for extattr in get_extatt
ribute_node_list(operation_node)], | 307 _EXTATTRIBUTES: [extattr_node_to_dict(extattr) for extattr in get_extatt
ribute_node_list(operation_node)], |
| 307 _STATIC: operation_node.GetProperty(_PROP_STATIC, default=False), | 308 _STATIC: operation_node.GetProperty(_PROP_STATIC, default=False), |
| 308 } | 309 } |
| 309 | 310 |
| 310 | 311 |
| 311 def get_extattribute_node_list(node): | 312 def get_extattribute_node_list(node): |
| 312 """Returns list of ExtAttribute. | 313 """Returns list of ExtAttribute. |
| 313 Args: | 314 Args: |
| 314 node: IDL node | 315 node: IDL node |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 partials_dict = {definition.GetName(): interface_node_to_dict(definition) | 432 partials_dict = {definition.GetName(): interface_node_to_dict(definition) |
| 432 for definition in get_definitions(path_list) | 433 for definition in get_definitions(path_list) |
| 433 if is_partial(definition)} | 434 if is_partial(definition)} |
| 434 dictionary = merge_partial_dicts(interfaces_dict, partials_dict) | 435 dictionary = merge_partial_dicts(interfaces_dict, partials_dict) |
| 435 interfaces_dict = merge_implement_nodes(interfaces_dict, implement_node_list
) | 436 interfaces_dict = merge_implement_nodes(interfaces_dict, implement_node_list
) |
| 436 export_to_jsonfile(dictionary, json_file) | 437 export_to_jsonfile(dictionary, json_file) |
| 437 | 438 |
| 438 | 439 |
| 439 if __name__ == '__main__': | 440 if __name__ == '__main__': |
| 440 main(sys.argv[1:]) | 441 main(sys.argv[1:]) |
| OLD | NEW |