| 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 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 """ | 866 """ |
| 867 Returns: | 867 Returns: |
| 868 Dictionary of {ExtAttributeName: ExtAttributeValue}. | 868 Dictionary of {ExtAttributeName: ExtAttributeValue}. |
| 869 Value is usually a string, with these exceptions: | 869 Value is usually a string, with these exceptions: |
| 870 Constructors: value is a list of Arguments nodes, corresponding to | 870 Constructors: value is a list of Arguments nodes, corresponding to |
| 871 possible signatures of the constructor. | 871 possible signatures of the constructor. |
| 872 CustomConstructors: value is a list of Arguments nodes, corresponding to | 872 CustomConstructors: value is a list of Arguments nodes, corresponding to |
| 873 possible signatures of the custom constructor. | 873 possible signatures of the custom constructor. |
| 874 NamedConstructor: value is a Call node, corresponding to the single | 874 NamedConstructor: value is a Call node, corresponding to the single |
| 875 signature of the named constructor. | 875 signature of the named constructor. |
| 876 SetWrapperReferenceTo: value is an Arguments node. | |
| 877 """ | 876 """ |
| 878 # Primarily just make a dictionary from the children. | 877 # Primarily just make a dictionary from the children. |
| 879 # The only complexity is handling various types of constructors: | 878 # The only complexity is handling various types of constructors: |
| 880 # Constructors and Custom Constructors can have duplicate entries due to | 879 # Constructors and Custom Constructors can have duplicate entries due to |
| 881 # overloading, and thus are stored in temporary lists. | 880 # overloading, and thus are stored in temporary lists. |
| 882 # However, Named Constructors cannot be overloaded, and thus do not have | 881 # However, Named Constructors cannot be overloaded, and thus do not have |
| 883 # a list. | 882 # a list. |
| 884 # FIXME: move Constructor logic into separate function, instead of modifying | 883 # FIXME: move Constructor logic into separate function, instead of modifying |
| 885 # extended attributes in-place. | 884 # extended attributes in-place. |
| 886 constructors = [] | 885 constructors = [] |
| (...skipping 18 matching lines...) Expand all Loading... |
| 905 raise ValueError('Constructor only supports Arguments as child,
but has child of class: %s' % child_class) | 904 raise ValueError('Constructor only supports Arguments as child,
but has child of class: %s' % child_class) |
| 906 constructors.append(child) | 905 constructors.append(child) |
| 907 elif name == 'CustomConstructor': | 906 elif name == 'CustomConstructor': |
| 908 if child_class and child_class != 'Arguments': | 907 if child_class and child_class != 'Arguments': |
| 909 raise ValueError('[CustomConstructor] only supports Arguments as
child, but has child of class: %s' % child_class) | 908 raise ValueError('[CustomConstructor] only supports Arguments as
child, but has child of class: %s' % child_class) |
| 910 custom_constructors.append(child) | 909 custom_constructors.append(child) |
| 911 elif name == 'NamedConstructor': | 910 elif name == 'NamedConstructor': |
| 912 if child_class and child_class != 'Call': | 911 if child_class and child_class != 'Call': |
| 913 raise ValueError('[NamedConstructor] only supports Call as child
, but has child of class: %s' % child_class) | 912 raise ValueError('[NamedConstructor] only supports Call as child
, but has child of class: %s' % child_class) |
| 914 extended_attributes[name] = child | 913 extended_attributes[name] = child |
| 915 elif name == 'SetWrapperReferenceTo': | |
| 916 if not child: | |
| 917 raise ValueError('[SetWrapperReferenceTo] requires a child, but
has none.') | |
| 918 children = child.GetChildren() | |
| 919 if len(children) != 1: | |
| 920 raise ValueError('[SetWrapperReferenceTo] supports only one chil
d.') | |
| 921 if child_class != 'Arguments': | |
| 922 raise ValueError('[SetWrapperReferenceTo] only supports Argument
s as child, but has child of class: %s' % child_class) | |
| 923 extended_attributes[name] = IdlArgument(children[0]) | |
| 924 elif name == 'Exposed': | 914 elif name == 'Exposed': |
| 925 if child_class and child_class != 'Arguments': | 915 if child_class and child_class != 'Arguments': |
| 926 raise ValueError('[Exposed] only supports Arguments as child, bu
t has child of class: %s' % child_class) | 916 raise ValueError('[Exposed] only supports Arguments as child, bu
t has child of class: %s' % child_class) |
| 927 exposures = [] | 917 exposures = [] |
| 928 if child_class == 'Arguments': | 918 if child_class == 'Arguments': |
| 929 exposures = [Exposure(exposed=str(arg.idl_type), | 919 exposures = [Exposure(exposed=str(arg.idl_type), |
| 930 runtime_enabled=arg.name) | 920 runtime_enabled=arg.name) |
| 931 for arg in arguments_node_to_arguments(child)] | 921 for arg in arguments_node_to_arguments(child)] |
| 932 else: | 922 else: |
| 933 value = extended_attribute_node.GetProperty('VALUE') | 923 value = extended_attribute_node.GetProperty('VALUE') |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1141 self.visit_typed_object(argument) | 1131 self.visit_typed_object(argument) |
| 1142 | 1132 |
| 1143 def visit_iterable(self, iterable): | 1133 def visit_iterable(self, iterable): |
| 1144 self.visit_typed_object(iterable) | 1134 self.visit_typed_object(iterable) |
| 1145 | 1135 |
| 1146 def visit_maplike(self, maplike): | 1136 def visit_maplike(self, maplike): |
| 1147 self.visit_typed_object(maplike) | 1137 self.visit_typed_object(maplike) |
| 1148 | 1138 |
| 1149 def visit_setlike(self, setlike): | 1139 def visit_setlike(self, setlike): |
| 1150 self.visit_typed_object(setlike) | 1140 self.visit_typed_object(setlike) |
| OLD | NEW |