| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 166 |
| 167 | 167 |
| 168 ################################################################################ | 168 ################################################################################ |
| 169 # Callback Functions | 169 # Callback Functions |
| 170 ################################################################################ | 170 ################################################################################ |
| 171 | 171 |
| 172 class IdlCallbackFunction(TypedObject): | 172 class IdlCallbackFunction(TypedObject): |
| 173 def __init__(self, idl_name, node): | 173 def __init__(self, idl_name, node): |
| 174 children = node.GetChildren() | 174 children = node.GetChildren() |
| 175 num_children = len(children) | 175 num_children = len(children) |
| 176 if num_children != 2: | 176 if num_children < 2 or num_children > 3: |
| 177 raise ValueError('Expected 2 children, got %s' % num_children) | 177 raise ValueError('Expected 2 or 3 children, got %s' % num_children) |
| 178 type_node, arguments_node = children | 178 type_node = children[0] |
| 179 arguments_node = children[1] |
| 180 if num_children == 3: |
| 181 ext_attributes_node = children[2] |
| 182 self.extended_attributes = ( |
| 183 ext_attributes_node_to_extended_attributes(idl_name, ext_attribu
tes_node)) |
| 184 else: |
| 185 self.extended_attributes = {} |
| 179 arguments_node_class = arguments_node.GetClass() | 186 arguments_node_class = arguments_node.GetClass() |
| 180 if arguments_node_class != 'Arguments': | 187 if arguments_node_class != 'Arguments': |
| 181 raise ValueError('Expected Arguments node, got %s' % arguments_node_
class) | 188 raise ValueError('Expected Arguments node, got %s' % arguments_node_
class) |
| 182 | 189 |
| 183 self.idl_name = idl_name | 190 self.idl_name = idl_name |
| 184 self.name = node.GetName() | 191 self.name = node.GetName() |
| 185 self.idl_type = type_node_to_type(type_node) | 192 self.idl_type = type_node_to_type(type_node) |
| 186 self.arguments = arguments_node_to_arguments(idl_name, arguments_node) | 193 self.arguments = arguments_node_to_arguments(idl_name, arguments_node) |
| 187 | 194 |
| 188 def accept(self, visitor): | 195 def accept(self, visitor): |
| (...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1119 self.visit_typed_object(argument) | 1126 self.visit_typed_object(argument) |
| 1120 | 1127 |
| 1121 def visit_iterable(self, iterable): | 1128 def visit_iterable(self, iterable): |
| 1122 self.visit_typed_object(iterable) | 1129 self.visit_typed_object(iterable) |
| 1123 | 1130 |
| 1124 def visit_maplike(self, maplike): | 1131 def visit_maplike(self, maplike): |
| 1125 self.visit_typed_object(maplike) | 1132 self.visit_typed_object(maplike) |
| 1126 | 1133 |
| 1127 def visit_setlike(self, setlike): | 1134 def visit_setlike(self, setlike): |
| 1128 self.visit_typed_object(setlike) | 1135 self.visit_typed_object(setlike) |
| OLD | NEW |