| 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 elif child_class == 'Setlike': | 348 elif child_class == 'Setlike': |
| 349 self.setlike = IdlSetlike(child) | 349 self.setlike = IdlSetlike(child) |
| 350 else: | 350 else: |
| 351 raise ValueError('Unrecognized node class: %s' % child_class) | 351 raise ValueError('Unrecognized node class: %s' % child_class) |
| 352 | 352 |
| 353 if len(filter(None, [self.iterable, self.maplike, self.setlike])) > 1: | 353 if len(filter(None, [self.iterable, self.maplike, self.setlike])) > 1: |
| 354 raise ValueError('Interface can only have one of iterable<>, maplike
<> and setlike<>.') | 354 raise ValueError('Interface can only have one of iterable<>, maplike
<> and setlike<>.') |
| 355 | 355 |
| 356 if has_integer_typed_length and has_indexed_property_getter: | 356 if has_integer_typed_length and has_indexed_property_getter: |
| 357 self.has_indexed_elements = True | 357 self.has_indexed_elements = True |
| 358 else: |
| 359 if self.iterable is not None and self.iterable.key_type is None: |
| 360 raise ValueError('Value iterators (iterable<V>) must be accompan
ied by an indexed ' |
| 361 'property getter and an integer-typed length at
tribute.') |
| 358 | 362 |
| 359 def accept(self, visitor): | 363 def accept(self, visitor): |
| 360 visitor.visit_interface(self) | 364 visitor.visit_interface(self) |
| 361 for attribute in self.attributes: | 365 for attribute in self.attributes: |
| 362 attribute.accept(visitor) | 366 attribute.accept(visitor) |
| 363 for constant in self.constants: | 367 for constant in self.constants: |
| 364 constant.accept(visitor) | 368 constant.accept(visitor) |
| 365 for constructor in self.constructors: | 369 for constructor in self.constructors: |
| 366 constructor.accept(visitor) | 370 constructor.accept(visitor) |
| 367 for custom_constructor in self.custom_constructors: | 371 for custom_constructor in self.custom_constructors: |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1111 self.visit_typed_object(argument) | 1115 self.visit_typed_object(argument) |
| 1112 | 1116 |
| 1113 def visit_iterable(self, iterable): | 1117 def visit_iterable(self, iterable): |
| 1114 self.visit_typed_object(iterable) | 1118 self.visit_typed_object(iterable) |
| 1115 | 1119 |
| 1116 def visit_maplike(self, maplike): | 1120 def visit_maplike(self, maplike): |
| 1117 self.visit_typed_object(maplike) | 1121 self.visit_typed_object(maplike) |
| 1118 | 1122 |
| 1119 def visit_setlike(self, setlike): | 1123 def visit_setlike(self, setlike): |
| 1120 self.visit_typed_object(setlike) | 1124 self.visit_typed_object(setlike) |
| OLD | NEW |