OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 import copy | 6 import copy |
7 import database | 7 import database |
8 import idlparser | 8 import idlparser |
9 import logging | 9 import logging |
10 import os | 10 import os |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 setter_attr = copy.deepcopy(attribute) | 119 setter_attr = copy.deepcopy(attribute) |
120 setter_attr.is_fc_setter = True | 120 setter_attr.is_fc_setter = True |
121 new_attributes.append(setter_attr) | 121 new_attributes.append(setter_attr) |
122 interface.attributes = new_attributes | 122 interface.attributes = new_attributes |
123 | 123 |
124 # Add 'Optional' attribute to whitelisted arguments. | 124 # Add 'Optional' attribute to whitelisted arguments. |
125 for op in interface.operations: | 125 for op in interface.operations: |
126 for i in range(0, len(op.arguments)): | 126 for i in range(0, len(op.arguments)): |
127 argument = op.arguments[i] | 127 argument = op.arguments[i] |
128 in_optional_whitelist = (interface.id, op.id, argument.id) in optional_a
rgument_whitelist | 128 in_optional_whitelist = (interface.id, op.id, argument.id) in optional_a
rgument_whitelist |
129 if in_optional_whitelist or set(['Optional', 'Callback']).issubset(argum
ent.ext_attrs.keys()): | 129 if in_optional_whitelist: |
130 argument.ext_attrs['Optional'] = None | 130 argument.ext_attrs['Optional'] = None |
131 argument.ext_attrs['RequiredCppParameter'] = None | |
132 | 131 |
133 def _rename_types(self, idl_file, import_options): | 132 def _rename_types(self, idl_file, import_options): |
134 """Rename interface and type names with names provided in the | 133 """Rename interface and type names with names provided in the |
135 options. Also clears scopes from scoped names""" | 134 options. Also clears scopes from scoped names""" |
136 | 135 |
137 def rename(name): | 136 def rename(name): |
138 name_parts = name.split('::') | 137 name_parts = name.split('::') |
139 name = name_parts[-1] | 138 name = name_parts[-1] |
140 if name in import_options.type_rename_map: | 139 if name in import_options.type_rename_map: |
141 name = import_options.type_rename_map[name] | 140 name = import_options.type_rename_map[name] |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 annotation = idl_node.annotations[source] | 555 annotation = idl_node.annotations[source] |
557 for name, value in annotation.items(): | 556 for name, value in annotation.items(): |
558 if (name in top_level_annotation | 557 if (name in top_level_annotation |
559 and value == top_level_annotation[name]): | 558 and value == top_level_annotation[name]): |
560 del annotation[name] | 559 del annotation[name] |
561 | 560 |
562 map(normalize, interface.parents) | 561 map(normalize, interface.parents) |
563 map(normalize, interface.constants) | 562 map(normalize, interface.constants) |
564 map(normalize, interface.attributes) | 563 map(normalize, interface.attributes) |
565 map(normalize, interface.operations) | 564 map(normalize, interface.operations) |
OLD | NEW |