| 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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 self.operations.append(IdlOperation.from_exception_operation_nod
e(child)) | 434 self.operations.append(IdlOperation.from_exception_operation_nod
e(child)) |
| 435 else: | 435 else: |
| 436 raise ValueError('Unrecognized node class: %s' % child_class) | 436 raise ValueError('Unrecognized node class: %s' % child_class) |
| 437 | 437 |
| 438 | 438 |
| 439 ################################################################################ | 439 ################################################################################ |
| 440 # Attributes | 440 # Attributes |
| 441 ################################################################################ | 441 ################################################################################ |
| 442 | 442 |
| 443 class IdlAttribute(TypedObject): | 443 class IdlAttribute(TypedObject): |
| 444 def __init__(self, node): | 444 def __init__(self, node=None): |
| 445 self.is_read_only = bool(node.GetProperty('READONLY')) | 445 self.is_read_only = bool(node.GetProperty('READONLY')) if node else Fals
e |
| 446 self.is_static = bool(node.GetProperty('STATIC')) | 446 self.is_static = bool(node.GetProperty('STATIC')) if node else False |
| 447 self.name = node.GetName() | 447 self.name = node.GetName() if node else None |
| 448 # Defaults, overridden below | |
| 449 self.idl_type = None | 448 self.idl_type = None |
| 450 self.extended_attributes = {} | 449 self.extended_attributes = {} |
| 451 | 450 |
| 452 children = node.GetChildren() | 451 if node: |
| 453 for child in children: | 452 children = node.GetChildren() |
| 454 child_class = child.GetClass() | 453 for child in children: |
| 455 if child_class == 'Type': | 454 child_class = child.GetClass() |
| 456 self.idl_type = type_node_to_type(child) | 455 if child_class == 'Type': |
| 457 elif child_class == 'ExtAttributes': | 456 self.idl_type = type_node_to_type(child) |
| 458 self.extended_attributes = ext_attributes_node_to_extended_attri
butes(child) | 457 elif child_class == 'ExtAttributes': |
| 459 else: | 458 self.extended_attributes = ext_attributes_node_to_extended_a
ttributes(child) |
| 460 raise ValueError('Unrecognized node class: %s' % child_class) | 459 else: |
| 460 raise ValueError('Unrecognized node class: %s' % child_class
) |
| 461 | 461 |
| 462 def accept(self, visitor): | 462 def accept(self, visitor): |
| 463 visitor.visit_attribute(self) | 463 visitor.visit_attribute(self) |
| 464 | 464 |
| 465 | 465 |
| 466 ################################################################################ | 466 ################################################################################ |
| 467 # Constants | 467 # Constants |
| 468 ################################################################################ | 468 ################################################################################ |
| 469 | 469 |
| 470 class IdlConstant(TypedObject): | 470 class IdlConstant(TypedObject): |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1111 self.visit_typed_object(argument) | 1111 self.visit_typed_object(argument) |
| 1112 | 1112 |
| 1113 def visit_iterable(self, iterable): | 1113 def visit_iterable(self, iterable): |
| 1114 self.visit_typed_object(iterable) | 1114 self.visit_typed_object(iterable) |
| 1115 | 1115 |
| 1116 def visit_maplike(self, maplike): | 1116 def visit_maplike(self, maplike): |
| 1117 self.visit_typed_object(maplike) | 1117 self.visit_typed_object(maplike) |
| 1118 | 1118 |
| 1119 def visit_setlike(self, setlike): | 1119 def visit_setlike(self, setlike): |
| 1120 self.visit_typed_object(setlike) | 1120 self.visit_typed_object(setlike) |
| OLD | NEW |