Chromium Code Reviews| 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 = False | |
| 446 self.is_static = False | |
| 447 self.name = None | |
| 448 if not node: | |
| 449 return | |
| 450 | |
| 445 self.is_read_only = bool(node.GetProperty('READONLY')) | 451 self.is_read_only = bool(node.GetProperty('READONLY')) |
|
peria
2016/12/15 04:57:08
Could you merge these 3 lines with the new lines?
dglazkov
2016/12/15 05:24:24
They are set above, right?
peria
2016/12/15 05:33:40
Yes, on this CL.
But my concern is same with bashi
| |
| 446 self.is_static = bool(node.GetProperty('STATIC')) | 452 self.is_static = bool(node.GetProperty('STATIC')) |
| 447 self.name = node.GetName() | 453 self.name = node.GetName() |
| 448 # Defaults, overridden below | 454 # Defaults, overridden below |
|
bashi
2016/12/15 04:51:15
nit: I think we can remove this comment (it's obvi
| |
| 449 self.idl_type = None | 455 self.idl_type = None |
| 450 self.extended_attributes = {} | 456 self.extended_attributes = {} |
|
bashi
2016/12/15 04:51:15
Can we move these two lines before 'if not node:'
| |
| 451 | 457 |
| 452 children = node.GetChildren() | 458 children = node.GetChildren() |
|
peria
2016/12/15 04:57:08
ditto.
children = node.GetChildren() if node els
| |
| 453 for child in children: | 459 for child in children: |
| 454 child_class = child.GetClass() | 460 child_class = child.GetClass() |
| 455 if child_class == 'Type': | 461 if child_class == 'Type': |
| 456 self.idl_type = type_node_to_type(child) | 462 self.idl_type = type_node_to_type(child) |
| 457 elif child_class == 'ExtAttributes': | 463 elif child_class == 'ExtAttributes': |
| 458 self.extended_attributes = ext_attributes_node_to_extended_attri butes(child) | 464 self.extended_attributes = ext_attributes_node_to_extended_attri butes(child) |
| 459 else: | 465 else: |
| 460 raise ValueError('Unrecognized node class: %s' % child_class) | 466 raise ValueError('Unrecognized node class: %s' % child_class) |
| 461 | 467 |
| 462 def accept(self, visitor): | 468 def accept(self, visitor): |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1111 self.visit_typed_object(argument) | 1117 self.visit_typed_object(argument) |
| 1112 | 1118 |
| 1113 def visit_iterable(self, iterable): | 1119 def visit_iterable(self, iterable): |
| 1114 self.visit_typed_object(iterable) | 1120 self.visit_typed_object(iterable) |
| 1115 | 1121 |
| 1116 def visit_maplike(self, maplike): | 1122 def visit_maplike(self, maplike): |
| 1117 self.visit_typed_object(maplike) | 1123 self.visit_typed_object(maplike) |
| 1118 | 1124 |
| 1119 def visit_setlike(self, setlike): | 1125 def visit_setlike(self, setlike): |
| 1120 self.visit_typed_object(setlike) | 1126 self.visit_typed_object(setlike) |
| OLD | NEW |