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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 # Resolve typedefs with the actual types and then discard the Typedefs. | 141 # Resolve typedefs with the actual types and then discard the Typedefs. |
142 # http://www.w3.org/TR/WebIDL/#idl-typedefs | 142 # http://www.w3.org/TR/WebIDL/#idl-typedefs |
143 self.resolve_typedefs(typedefs) | 143 self.resolve_typedefs(typedefs) |
144 | 144 |
145 def resolve_typedefs(self, typedefs): | 145 def resolve_typedefs(self, typedefs): |
146 for callback_function in self.callback_functions.itervalues(): | 146 for callback_function in self.callback_functions.itervalues(): |
147 callback_function.resolve_typedefs(typedefs) | 147 callback_function.resolve_typedefs(typedefs) |
148 for interface in self.interfaces.itervalues(): | 148 for interface in self.interfaces.itervalues(): |
149 interface.resolve_typedefs(typedefs) | 149 interface.resolve_typedefs(typedefs) |
150 | 150 |
151 def merge(self, other): | |
Nils Barth (inactive)
2014/03/20 01:01:46
This is a useful method!
Could you:
1. Move the at
Nils Barth (inactive)
2014/03/20 02:11:11
This method is a great idea, so I've implemented i
| |
152 self.callback_functions.update(other.callback_functions) | |
153 self.enumerations.update(other.enumerations) | |
154 | |
151 | 155 |
152 ################################################################################ | 156 ################################################################################ |
153 # Callback Functions | 157 # Callback Functions |
154 ################################################################################ | 158 ################################################################################ |
155 | 159 |
156 class IdlCallbackFunction(TypedObject): | 160 class IdlCallbackFunction(TypedObject): |
157 def __init__(self, node): | 161 def __init__(self, node): |
158 children = node.GetChildren() | 162 children = node.GetChildren() |
159 num_children = len(children) | 163 num_children = len(children) |
160 if num_children != 2: | 164 if num_children != 2: |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
620 child_class = child.GetClass() | 624 child_class = child.GetClass() |
621 if child_class != 'Type': | 625 if child_class != 'Type': |
622 raise ValueError('Unrecognized node class: %s' % child_class) | 626 raise ValueError('Unrecognized node class: %s' % child_class) |
623 return type_node_to_type(child) | 627 return type_node_to_type(child) |
624 | 628 |
625 | 629 |
626 def union_type_node_to_idl_union_type(node, is_nullable=False): | 630 def union_type_node_to_idl_union_type(node, is_nullable=False): |
627 member_types = [type_node_to_type(member_type_node) | 631 member_types = [type_node_to_type(member_type_node) |
628 for member_type_node in node.GetChildren()] | 632 for member_type_node in node.GetChildren()] |
629 return IdlUnionType(member_types, is_nullable=is_nullable) | 633 return IdlUnionType(member_types, is_nullable=is_nullable) |
OLD | NEW |