OLD | NEW |
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 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 | 630 |
631 | 631 |
632 ################################################################################ | 632 ################################################################################ |
633 # Extended attributes | 633 # Extended attributes |
634 ################################################################################ | 634 ################################################################################ |
635 | 635 |
636 def ext_attributes_node_to_extended_attributes(idl_name, node): | 636 def ext_attributes_node_to_extended_attributes(idl_name, node): |
637 """ | 637 """ |
638 Returns: | 638 Returns: |
639 Dictionary of {ExtAttributeName: ExtAttributeValue}. | 639 Dictionary of {ExtAttributeName: ExtAttributeValue}. |
640 Value is usually a string, with three exceptions: | 640 Value is usually a string, with these exceptions: |
641 Constructors: value is a list of Arguments nodes, corresponding to | 641 Constructors: value is a list of Arguments nodes, corresponding to |
642 possible signatures of the constructor. | 642 possible signatures of the constructor. |
643 CustomConstructors: value is a list of Arguments nodes, corresponding to | 643 CustomConstructors: value is a list of Arguments nodes, corresponding to |
644 possible signatures of the custom constructor. | 644 possible signatures of the custom constructor. |
645 NamedConstructor: value is a Call node, corresponding to the single | 645 NamedConstructor: value is a Call node, corresponding to the single |
646 signature of the named constructor. | 646 signature of the named constructor. |
| 647 SetWrapperReferenceTo: value is an Arguments node. |
647 """ | 648 """ |
648 # Primarily just make a dictionary from the children. | 649 # Primarily just make a dictionary from the children. |
649 # The only complexity is handling various types of constructors: | 650 # The only complexity is handling various types of constructors: |
650 # Constructors and Custom Constructors can have duplicate entries due to | 651 # Constructors and Custom Constructors can have duplicate entries due to |
651 # overloading, and thus are stored in temporary lists. | 652 # overloading, and thus are stored in temporary lists. |
652 # However, Named Constructors cannot be overloaded, and thus do not have | 653 # However, Named Constructors cannot be overloaded, and thus do not have |
653 # a list. | 654 # a list. |
654 # FIXME: move Constructor logic into separate function, instead of modifying | 655 # FIXME: move Constructor logic into separate function, instead of modifying |
655 # extended attributes in-place. | 656 # extended attributes in-place. |
656 constructors = [] | 657 constructors = [] |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 child_class = child.GetClass() | 815 child_class = child.GetClass() |
815 if child_class != 'Type': | 816 if child_class != 'Type': |
816 raise ValueError('Unrecognized node class: %s' % child_class) | 817 raise ValueError('Unrecognized node class: %s' % child_class) |
817 return type_node_to_type(child) | 818 return type_node_to_type(child) |
818 | 819 |
819 | 820 |
820 def union_type_node_to_idl_union_type(node): | 821 def union_type_node_to_idl_union_type(node): |
821 member_types = [type_node_to_type(member_type_node) | 822 member_types = [type_node_to_type(member_type_node) |
822 for member_type_node in node.GetChildren()] | 823 for member_type_node in node.GetChildren()] |
823 return IdlUnionType(member_types) | 824 return IdlUnionType(member_types) |
OLD | NEW |