| 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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 name = 'NamedConstructor' | 431 name = 'NamedConstructor' |
| 432 call_node = extended_attributes['NamedConstructor'] | 432 call_node = extended_attributes['NamedConstructor'] |
| 433 extended_attributes['NamedConstructor'] = call_node.GetName() | 433 extended_attributes['NamedConstructor'] = call_node.GetName() |
| 434 overloaded_index = None # named constructors are not overloaded | 434 overloaded_index = None # named constructors are not overloaded |
| 435 children = call_node.GetChildren() | 435 children = call_node.GetChildren() |
| 436 if len(children) != 1: | 436 if len(children) != 1: |
| 437 raise ValueError('NamedConstructor node expects 1 child, got %s.' %
len(children)) | 437 raise ValueError('NamedConstructor node expects 1 child, got %s.' %
len(children)) |
| 438 arguments_node = children[0] | 438 arguments_node = children[0] |
| 439 arguments = arguments_node_to_arguments(arguments_node) | 439 arguments = arguments_node_to_arguments(arguments_node) |
| 440 named_constructor = IdlOperation(name=name, extended_attributes=extended
_attributes, overloaded_index=overloaded_index, arguments=arguments) | 440 named_constructor = IdlOperation(name=name, extended_attributes=extended
_attributes, overloaded_index=overloaded_index, arguments=arguments) |
| 441 # FIXME: should return named_constructor separately; appended for Perl |
| 441 constructors.append(named_constructor) | 442 constructors.append(named_constructor) |
| 442 | 443 |
| 443 return constructors, custom_constructors | 444 return constructors, custom_constructors |
| 444 | 445 |
| 445 | 446 |
| 446 def clear_constructor_attributes(extended_attributes): | 447 def clear_constructor_attributes(extended_attributes): |
| 447 # Deletes Constructor*s* (plural), sets Constructor (singular) | 448 # Deletes Constructor*s* (plural), sets Constructor (singular) |
| 448 if 'Constructors' in extended_attributes: | 449 if 'Constructors' in extended_attributes: |
| 449 del extended_attributes['Constructors'] | 450 del extended_attributes['Constructors'] |
| 450 extended_attributes['Constructor'] = None | 451 extended_attributes['Constructor'] = None |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 sequence_type = type_node_to_type(sequence_child) | 502 sequence_type = type_node_to_type(sequence_child) |
| 502 return 'sequence<%s>' % sequence_type | 503 return 'sequence<%s>' % sequence_type |
| 503 | 504 |
| 504 | 505 |
| 505 def union_type_node_to_idl_union_type(node): | 506 def union_type_node_to_idl_union_type(node): |
| 506 union_member_types = [] | 507 union_member_types = [] |
| 507 for member_type_node in node.GetChildren(): | 508 for member_type_node in node.GetChildren(): |
| 508 member_type = type_node_to_type(member_type_node) | 509 member_type = type_node_to_type(member_type_node) |
| 509 union_member_types.append(member_type) | 510 union_member_types.append(member_type) |
| 510 return IdlUnionType(union_member_types=union_member_types) | 511 return IdlUnionType(union_member_types=union_member_types) |
| OLD | NEW |